LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-16-2004, 05:04 PM   #1
Zolan
LQ Newbie
 
Registered: Mar 2004
Distribution: Debian
Posts: 21

Rep: Reputation: 15
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.
 
Old 10-16-2004, 07:07 PM   #2
serz
Member
 
Registered: Apr 2003
Location: Buenos Aires, Argentina
Distribution: Slackware, Gentoo
Posts: 397

Rep: Reputation: 30
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.
 
Old 10-16-2004, 10:02 PM   #3
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
startup and shutdown script android6011 Slackware 3 11-03-2005 05:04 PM
script at the shutdown dominant SUSE / openSUSE 4 10-15-2005 08:43 AM
shutdown script acidjuice Slackware 3 04-09-2005 06:19 PM
Shutdown script Hexane Mandriva 7 01-28-2005 02:36 AM
Start-Up/Shutdown Script ptreves Linux - Newbie 1 09-15-2004 05:27 PM


All times are GMT -5. The time now is 12:41 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration