LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to restart the pc for in a script? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-restart-the-pc-for-in-a-script-841422/)

joesto 10-30-2010 01:52 PM

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

TobiSGD 10-30-2010 01:57 PM

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


paulsm4 10-30-2010 02:15 PM

As "root":
Code:

reboot -i

joesto 10-30-2010 02:34 PM

thanks will give that a try

joe

udaman 10-30-2010 02:36 PM

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

John VV 10-31-2010 01:23 AM

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


All times are GMT -5. The time now is 05:22 AM.