LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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-30-2010, 01:52 PM   #1
joesto
LQ Newbie
 
Registered: Jun 2010
Location: liverpool GB
Distribution: ubuntu 10.4
Posts: 18

Rep: Reputation: 0
Question how to restart the pc for in a script?


i can you give me a tip on how to make the pc restart
i have tried
restart
reboot but no luck
thanks
joe
 
Old 10-30-2010, 01:57 PM   #2
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,133
Blog Entries: 2

Rep: Reputation: 4839Reputation: 4839Reputation: 4839Reputation: 4839Reputation: 4839Reputation: 4839Reputation: 4839Reputation: 4839Reputation: 4839Reputation: 4839Reputation: 4839
Your icon says that you are using Ubuntu Linux, so you should use
Code:
sudo reboot
or
Code:
sudo shutdown -r now
In both cases you have to adjust your sudoers-file to allow the command without giving a password, if you want to run this in a script. You can do this with the command
Code:
sudo visudo
For more infos look at:
Code:
man reboot
man shutdown
man sudo
 
1 members found this post helpful.
Old 10-30-2010, 02:15 PM   #3
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
As "root":
Code:
reboot -i
 
Old 10-30-2010, 02:34 PM   #4
joesto
LQ Newbie
 
Registered: Jun 2010
Location: liverpool GB
Distribution: ubuntu 10.4
Posts: 18

Original Poster
Rep: Reputation: 0
Thumbs up

thanks will give that a try

joe
 
Old 10-30-2010, 02:36 PM   #5
udaman
Member
 
Registered: Oct 2010
Location: New England, USA
Distribution: OpenSUSE/Slackware64/RHEL/Mythbuntu
Posts: 187

Rep: Reputation: 39
From a script you should use the full path to the command:

To find the full path do:

Code:
# which reboot

/sbin/reboot

Then edit your script with the full path.

Code:
/sbin/reboot
 
1 members found this post helpful.
Old 10-31-2010, 01:23 AM   #6
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,107

Rep: Reputation: 2478Reputation: 2478Reputation: 2478Reputation: 2478Reputation: 2478Reputation: 2478Reputation: 2478Reputation: 2478Reputation: 2478Reputation: 2478Reputation: 2478
you can create a desktop icon to do that
--- for Gnome---
r-click the desktop
and select " create launcher"
and use " reboot" ( without the "") as the command
 
1 members found this post helpful.
  


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
restart script glennbtn Linux - Newbie 1 07-20-2010 05:13 AM
Script to restart 2 process riyan Linux - Networking 4 03-13-2010 09:40 AM
Script to restart services, if they are down. sabarishks Linux - Server 2 10-30-2008 07:29 PM
MySQL restart script? Fuwex Debian 2 08-17-2005 02:23 PM
Restart script blablaman Linux - Newbie 1 08-20-2004 06:09 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:27 AM.

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