Find the answer to your Linux question:
Results 1 to 4 of 4
Can someone tell me how to create a script, that automaticly restarts the computer at for example 05:00!...
  1. #1
    Just Joined!
    Join Date
    Jan 2007
    Posts
    42

    Need help with timed restart script!

    Can someone tell me how to create a script, that automaticly restarts the computer at for example 05:00!

  2. #2
    Linux Guru smolloy's Avatar
    Join Date
    Apr 2005
    Location
    CA, but from N.Ireland
    Posts
    2,413
    You could have a cron job that executes a script containing,
    Code:
    init 6
    Registered Linux user #388328 || Registered LFS user #15880
    AMD 64 X2 4600+ :: 2X1GB DDR2 800 :: GeForce 9400 GT 512MB :: ASUS M2N32 Deluxe :: 4X250GB SATAII
    Need instant help? Try us on IRC -- #linuxforums on freenode

  3. #3
    Just Joined!
    Join Date
    Jan 2007
    Posts
    42
    To be honnest, i didnt understand shi. of what u said, kinda newbie

    So if someone could explain it the newbie way Thanks.

  4. #4
    Linux Guru smolloy's Avatar
    Join Date
    Apr 2005
    Location
    CA, but from N.Ireland
    Posts
    2,413
    A cron job is a script that is scheduled to run at a specific time. So if you had a restart script, you could set up a cron job to run it at 5am every day. Google a bit on cron jobs, and you'll see how easy it is to set up.

    As for the restart script.
    Code:
    #!/bin/sh
    init 6
    That would do it, since "init 6" means "go to runlevel 6, and runlevel 6 means "reboot me". So save the previous code as a script -- e.g. restartscript.sh -- then make it executable by doing this,
    Code:
    chmod +x restartscript.sh
    Registered Linux user #388328 || Registered LFS user #15880
    AMD 64 X2 4600+ :: 2X1GB DDR2 800 :: GeForce 9400 GT 512MB :: ASUS M2N32 Deluxe :: 4X250GB SATAII
    Need instant help? Try us on IRC -- #linuxforums on freenode

Posting Permissions

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