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 363 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

        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 Reply Quote 0
        • R Offline
          rek769 @rek769
          last edited by

          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 Reply Quote 0
          • J Offline
            joe @rek769
            last edited by

            @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

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            • First post
              Last post