Announcement

Collapse
No announcement yet.

Setting root cron job in TaskSceduler to shutdown every morning / Kubuntu 12.04

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Setting root cron job in TaskSceduler to shutdown every morning / Kubuntu 12.04

    Hey there
    having a pain in the bum trying to set the system to shutdown at 09:00 every morning

    Im setting up a download/media server at my dads place so i wont be there to turn it off
    but i spent most of yesterday trying to work out how to get the machine to shutdown

    now Im at the point of setting a root cron job with
    Alt-F2: kdesudo kcmshell4 kcm_cron
    to apply a root job

    I have an executable in /home/al/ with the line : shutdown now
    and a link to it in task scheduler
    there must be a better way of going about this

    I would appreciate any and all help
    thanks
    Last edited by Guest; Oct 17, 2012, 09:28 AM. Reason: clarity

    #2
    You shouldn't need any scripts to shutdown the machine. Try this in a terminal:

    sudo kcmshell4 kcm_cron

    You'll be asked for your root password on the command line, enter it, then you'll get a bunch of messages in the terminal that you can safely ignore. The kcron interface will open. From there go to the system crons and enter as a new cron the command:

    shutdown now

    Set the time you want it to execute, apply it, and you're done. You can test it by setting the initiating time to around five minutes from when you entered it. The system should go down, then you can just restart it, re-run the terminal commands to access kcron as root, and set the time to what you want.

    The problem you were probably having with your script is anything run as root by cron has to be owned by root, and not writable by group or users. You can find out more in the cron manpage. In a terminal type 'man cron'.
    Computers don't make mistakes. They only execute them.

    Comment


      #3
      Log

      yeah i had realised that just before you posted
      so it now just runs the command shutdown now
      set as root in the system jobs tab


      #############
      *asking all remaining processes to terminate...
      modem-manager [2678]: <info> ModemManager (version 0.5.2.0) starting...

      modem-manager [2678]: could not get the system bus. Make sure the message bus daemon is running!
      Message:Failed to connect to socket /var/run/dbus/system_bus_socket :no such file or directory
      ##############
      then again with PID [2682], [2684], [2689]
      (this was copied to paper and back to machine so may be mistakes in spelling but not content)


      so i think it is trying to start new processes to shutdown which i presume is running in a merry-go-round
      could i add a variable to the task scheduler eg. make sure to shut dbus last or something of that nature

      Thanks for your help
      Last edited by Guest; Oct 16, 2012, 01:35 PM.

      Comment


        #4
        Running shutdown form a cronjob shouldn't be any difference to running it from outside the cronjob (such as by kdm)... Do you get the same erros when you shutdown normally or when you try "sudo shutdown now" from a terminal?

        Comment


          #5
          Humm ,,,, it's working as expected @hear .

          ran "kdesudo kcmshell4 kcm_cron" in a terminal , password box comes up , kcm_cron opens , check "system cron" , click new task , set command to "shutdown -h now" , set run as to root , time to every day at 5min in the future click ok then apply , sit back and wait .

          at exactly 6:20 the box shut down (6:20 was 5min in the future for me at that moment )

          VINNY
          i7 4core HT 8MB L3 2.9GHz
          16GB RAM
          Nvidia GTX 860M 4GB RAM 1152 cuda cores

          Comment


            #6
            noticed you used the -h argument
            i will try that when im back at my dads tomorrow
            thanks for the help guys i will post my result tomorrow

            UPDATE:
            THE ARGUMENT -h fixed this error so it now reads
            shutdown -h now

            thanks everyone
            Last edited by Guest; Oct 17, 2012, 09:25 AM.

            Comment

            Working...
            X