Results 1 to 7 of 7

Thread: How do I run a csh script at startup in a gnome-terminal?

  1. #1

    Default How do I run a csh script at startup in a gnome-terminal?

    I'm running openSUSE 11.4 32-bit and using the gnome desktop.

    I have a 320GB disk dedicated to linux that is split 50/50 to the operating system and as a storage device.
    This way whenever I install new systems, it only affects 1/2 of my disk while the other half I know will not
    be touched, and I can store things there more or less permanently. Now, I want to automatically save my
    home directory to that storage partition at the start of every month, but I do not use my computer every
    day, so I can't rely on doing this the first day of every month. So, I've come up with a scheme where I save
    my home directory on the storage partition to a directory made up of the year and month, ie, 2011_Oct.
    And I've written a csh script that checks the existence of this file, and if it does not exist then it saves my
    home directory, otherwise, it does nothing. That way each month I use the computer I will save a copy of
    my home directory, and it will only occur once per month. If I login and execute this manually, it works
    quite nicely. However, I want to automate this process, so I don't have to remember to do it.

    I have it so the system asks me what to do with an executable text file when I double click it. It displays
    "Do you want to run "script-file-name", or display its contents?", and has the following four buttons to choose
    from:

    Run in Terminal
    Display
    Cancel
    Run

    To test the first and last buttons, I wrote a dummy csh script that only touches a file in my home directory.
    I tested the first button, and it opened a gnome-terminal, the script ran, and the terminal closed. I verified
    that the file it touched got created. I then deleted the file, and tested the last button. This did nothing that
    I could visibly see, but it did run my script because I verified that the file got created. I don't know by what
    mechanism this ran. Can somebody tell me?

    The "Run in Terminal" is how I want my automated process to run, so I can see what's happening and I
    can use a prompt at the end of it for me to hit return to continue, ie, terminate. This allows me to see any
    script output and to know that it ran ok.

    I used "computer->control center->startup applications" to add my dummy script so it would execute at
    login and I know it runs because it created the file, but I don't see any terminal open, so I assume it ran
    as when I tested the "Run" button above.

    Now, how do I make this startup application behave as "Run in Terminal" as described above?
    Also, is what I'm wanting to accomplish the best way to go about it?, ie, I don't know where in the startup
    process that my script will run, so I want to be assured that it's ok to attempt to copy my home directory
    at this time (especially, since it could take a few minutes to do the copy, which means other things will
    not run until it completes). And if not, what other way should I do what I want to do?

    Thanks

    Ron

  2. #2

    Default Re: How do I run a csh script at startup in a gnome-terminal?

    Quote Originally Posted by rderosier View Post
    That way each month I use the computer I will save a copy of
    my home directory, and it will only occur once per month. If I login and execute this manually, it works
    quite nicely. However, I want to automate this process, so I don't have to remember to do it.
    Put your script in a cron job that will be executed once a month.

  3. #3
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: How do I run a csh script at startup in a gnome-terminal?

    On 2011-10-27 09:46, rderosier wrote:

    > I want to automatically save my
    > home directory to that storage partition at the start of every month,


    Create the script in /etc/cron.monthly/
    It will run as root once per month, even if your machine is not up all
    days. The output of the script is mailed be default to root.

    --
    Cheers / Saludos,

    Carlos E. R.
    (from 11.4 x86_64 "Celadon" at Telcontar)

  4. #4

    Default Re: How do I run a csh script at startup in a gnome-terminal?

    I'm not that familiar with cron jobs, but don't they run at specified times?
    That being the case, I ruled them out because my being on the system is
    not predictable for any given time or day, and I don't leave my machine
    running when I'm not using it. That's why I came up with the idea of doing
    something when I login every time and letting the script determine if it
    needed to do the copying or not. If I'm wrong about cron jobs, maybe you
    can educate me on what you mean.

  5. #5
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: How do I run a csh script at startup in a gnome-terminal?

    On 2011-10-28 02:56, rderosier wrote:
    >
    > I'm not that familiar with cron jobs, but don't they run at specified
    > times?
    > That being the case, I ruled them out because my being on the system is
    > not predictable for any given time or day, and I don't leave my machine
    > running when I'm not using it.


    The one I told you is guaranteed to run once a month. If your machine is
    off for two weeks when it should run, then it will run the first day you
    boot it.

    Believe me, you are not the first one with that need.

    The only thing is that it does not guarantee which day/hour it will run.
    Just that it runs once a month.

    The hour is adjustable somewhere else.


    --
    Cheers / Saludos,

    Carlos E. R.
    (from 11.4 x86_64 "Celadon" at Telcontar)

  6. #6

    Default Re: How do I run a csh script at startup in a gnome-terminal?

    Quote Originally Posted by rderosier View Post

    Now, how do I make this startup application behave as "Run in Terminal" as described above?
    I've discovered that setting the startup application's "Command" to the following does what I want:
    gnome-terminal -e /path-to-script-name/script-name

    I played around with cron and never got it to work so gave up on it.

  7. #7
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: How do I run a csh script at startup in a gnome-terminal?

    On 2011-11-03 02:26, rderosier wrote:

    > I played around with cron and never got it to work so gave up on it.


    Then ask.

    It is a crucial part of any Linux administration.

    --
    Cheers / Saludos,

    Carlos E. R.
    (from 11.4 x86_64 "Celadon" at Telcontar)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •