Cronjob help needed



  • Greetings all,
    I'm trying to set up a cronjob to turn off my UBports powered Nexus 5 each day at a certain time.

    Here is what I did from a terminal:

    sudo su
    mount / -o rw,remount
    crontab -e
    (here is my crontab entry made, and saved via Nano: 30 19 * * * shutdown -h now)
    (to auto shutdown at 7:30pm each day)

    The cronjob is not running (at least the phone is not shutting down as I would expect).
    I noticed that the crontab file I modified is located in the /tmp directory so I suspect that it is being deleted each time the phone reboots. Perhaps there is another way or place to modify the cronjob as root?

    Any ideas or help much appreciated.



  • Forced to find a solution elsewhere, I finally decided to edit the crontab file directly (located at /etc/crontab). Making the change directly instead of using crontab -e worked for me. I generally don't like editing that file directly since errors can cause all cronjobs to fail.



  • @rek769 Interesting. Thanks for the sharing the info. I wonder how apps can be started from cron, or vice versa.


Log in to reply