Shutdown PC after f@h work-unit is done

Discussion in 'all things UNIX' started by Becho, May 27, 2011.

Thread Status:
Not open for further replies.
  1. Becho

    Becho Registered Member

    Joined:
    Oct 16, 2007
    Posts:
    29
    Hello all again. I am participating in running F@H & I would like some help on how to add to my script a command to shut down the pc once the work-unit is done. I have F@H installed under my /home directory and use a script that runs in a terminal window. When the unit is done it automatically closes the terminal but I would also like it to shut down the pc. I run Xubuntu 11.04 64-bit. Here is the script:

    Code:
    #!/bin/bash
    cd Folding
    ./fah6 -oneunit -verbosity 9
    I google'd but to no avail.
     
  2. Mrkvonic

    Mrkvonic Linux Systems Expert

    Joined:
    May 9, 2005
    Posts:
    9,238
    There are many options.

    First you can add a shutdown command at the end of that script, provided fah runs in foreground. Second, you can create a symbolic link when that script starts and delete it when it adds, then have cron run every minute or so a script that check for the existence of the link; if it's there, don't shutdown and vice versa.

    And many others. But the way you describe it, adding a shutdown option at the end would work great.

    Mrk
     
  3. Becho

    Becho Registered Member

    Joined:
    Oct 16, 2007
    Posts:
    29
    Which command should I use?
    Code:
    && shutdown -f now
    Wouldn't that start the script and shut down the pc as soon as I click it. Also that would need root access? Thank you for the tips.
     
  4. Mrkvonic

    Mrkvonic Linux Systems Expert

    Joined:
    May 9, 2005
    Posts:
    9,238
    I meant in the bash script, add another line that reads shutdown <options>.
    You can test with echo "shutdown" to make sure the command is not executed too early.
    Mrk
     
Loading...
Thread Status:
Not open for further replies.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.