Computing.Net > Forums > Unix > reboot when not loged in as root

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

reboot when not loged in as root

Reply to Message Icon

Name: d3
Date: January 5, 2003 at 22:55:06 Pacific
OS: unix
CPU/Ram: G4 800
Comment:

How can I force a system reboot every night (logged in as admin NOT root)?

I tried making a script:

su
mypassword
reboot

and calling crontab to every night.. but it still prompts me for a password?



Sponsored Link
Ads by Google

Response Number 1
Name: David Perry
Date: January 6, 2003 at 02:52:48 Pacific
Reply:

Put the job in the crontab for root.

0 4 0 0 0 shutdown -y -i 6

Does your machine need to be rebooted every night? Sounds like something is wrong. Reboots are for system upgrades. Most unix boxes are happy with uptime measured in years.


0

Response Number 2
Name: d3
Date: January 6, 2003 at 15:01:30 Pacific
Reply:

But the cron job isn't fireing if i'm not logged in as
root? I need to know how to call shutdown from a
normal user because now all i get is presmission
denied errors.


0

Response Number 3
Name: David Perry
Date: January 6, 2003 at 16:14:47 Pacific
Reply:

Cron does not depend on a user to be logged in. Have you tried it? Are there not already scheduled tasks that run as root?

Having said that, if you create a script owned by root with the set uid bit set, the script will execute as root, no matter who actually starts it. << DANGER - BAD IDEA

#!/bin/sh
shutdown -i 6 -y


0

Response Number 4
Name: d3
Date: January 7, 2003 at 16:06:38 Pacific
Reply:

yep your right, all i was missing
was

/sbin/shutdown

it wasn't getting called unless i but the sbin in front


0

Response Number 5
Name: David Perry
Date: January 7, 2003 at 20:07:43 Pacific
Reply:

This is why many people either declare the PATH variable for cron scripts or use full path names to executables. Cron run in a severely limited shell.

You can add the verbose tracing to a script by putting 'set -x' near the top. That would show you what it is trying to do.


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: reboot when not loged in as root

Can't open modem? www.computing.net/answers/unix/cant-open-modem/461.html

Deleted sh file , no cannot log in as ro www.computing.net/answers/unix/deleted-sh-file-no-cannot-log-in-as-ro/1911.html

OPENWIN keeps locking up www.computing.net/answers/unix/openwin-keeps-locking-up/203.html