Results 1 to 3 of 3

Thread: User cron at power off?

  1. #1
    Join Date
    Feb 2007
    Beans
    863

    User cron at power off?

    Hi,

    crontab -e

    Code:
    @reboot sh ~/myscript.sh 
    @poweroff sh ~/myoffscript.sh
    @reboot works, but not @poweroff. Is there a possibility to run my script at power off using cron?

    thank you

  2. #2
    Join Date
    Sep 2006
    Beans
    8,627
    Distro
    Ubuntu 14.04 Trusty Tahr

    upstart

    crontab shows no @poweroff. That doesn't exist, as nice as it would be to have it.

    What you might do is set your script up as an upstart job that is activated when runlevel 0.

  3. #3
    Join Date
    Feb 2009
    Location
    Dallas, TX
    Beans
    7,591
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: User cron at power off?

    Hi honeybear.

    Crontab will only help you with reboot.

    AFAIK, for a shutdown script you have 2 options: an upstart script (see here), or a level 6 system script (read here).

    Let us know how it goes.
    Regards.

Bookmarks

Posting Permissions

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