• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
UBports Robot Logo UBports Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login

Cronjob help needed

Scheduled Pinned Locked Moved Support
3 Posts 2 Posters 275 Views 2 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R Offline
      rek769
      last edited by 15 Apr 2020, 18:30

      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.

      R 1 Reply Last reply 18 Apr 2020, 13:44 Reply Quote 0
      • R Offline
        rek769 @rek769
        last edited by 18 Apr 2020, 13:44

        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.

        J 1 Reply Last reply 18 Apr 2020, 15:09 Reply Quote 0
        • J Offline
          joe @rek769
          last edited by 18 Apr 2020, 15:09

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

          1 Reply Last reply Reply Quote 0
          1 out of 3
          • First post
            1/3
            Last post