LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   shutdown script (https://www.linuxquestions.org/questions/linux-newbie-8/shutdown-script-243535/)

Zolan 10-16-2004 04:04 PM

shutdown script
 
The problem is that i want the password typed in.
i know almost nothing about scripting because i have just taken a quick loock at it.
i want to do a script to shut down my computer.
i started with
su
echo "xxx"
shutdown -h now


But as you can amadgin that got me nowere.
i have tried numerous things.
I have searched the net and found nothing.

with this it still prompts me for the password, but i want it all to be done in the script.
well you got the idea.
Please help.

serz 10-16-2004 06:07 PM

Code:

#!/bin/bash

echo "Shutting down...."
su -c "shutdown -h now"

That's it.. you will get prompted for the root password.

Don't forget to chmod +x the script and put it somewhere you can run it.

Tinkster 10-16-2004 09:02 PM

Re: shutdown script
 
Quote:

Originally posted by Zolan
The problem is that i want the password typed in.
What you mean is that you don't want to
be prompted for a password?


Cheers,
Tink


All times are GMT -5. The time now is 11:51 PM.