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-25-2012, 08:36 PM   #1
SIcan
LQ Newbie
 
Registered: Mar 2011
Posts: 17

Rep: Reputation: 0
Question reboot script


how can i restart my pc with a script without password

Last edited by SIcan; 10-25-2012 at 08:43 PM.
 
Old 10-25-2012, 08:37 PM   #2
cbtshare
Member
 
Registered: Jul 2009
Posts: 619

Rep: Reputation: 42
the same way you would at the command line.Just put that in a script
 
Old 10-25-2012, 08:50 PM   #3
SIcan
LQ Newbie
 
Registered: Mar 2011
Posts: 17

Original Poster
Rep: Reputation: 0
Thank you the quick answer !

i have tried :

reboot

It works in the command line but not in the script
 
Old 10-26-2012, 12:33 AM   #4
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
Which OS you're using? And what's need to doing this.
As far as I know, you can do such password less login after a reboot, in any remote system using command line. But since you're trying it on your local system, then it shouldn't accept your password through a script because it would prompt for a password on GUI based login prompt, not on command line.
Second problem is, script should be executed 2 times, one before rebooting to invoke reboot command, and second after reboot to enter username & password, so how would you run a script second time before login into the system? It's practically not seem possible.
On the other hand, there's little possibility by adding such script in /etc/init/rc.d directroy, and you can explore it.
 
Old 10-28-2012, 12:33 AM   #5
SIcan
LQ Newbie
 
Registered: Mar 2011
Posts: 17

Original Poster
Rep: Reputation: 0
Thank you shivaa,

the os is linux ubuntu 12,

I have a PC (station) connected to internet that i want remote .
i get regulary information from and i send information and commands to it.sometime to resolve errors i have to reboot it.
that the reason why i look for a script that i can send it to reboot it.


i get
 
Old 10-28-2012, 11:28 PM   #6
SIcan
LQ Newbie
 
Registered: Mar 2011
Posts: 17

Original Poster
Rep: Reputation: 0
i have tried with chown root:root and chmod 475
but it asks for password ???
 
Old 10-29-2012, 12:28 AM   #7
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
Is the PC you want to reboot a remote one? If yes, then how are you accessing it, I mean what tool and commands (i.e. ssh, telnet etc) you're using?
Anyway, as far as I could understand, you can create a script somethng like this (below is just a hint, not exact script):
Code:
#!/bin/bash
user=<your-username>
host=<remote_host>

ssh $user@<remote_host> "reboot" 2>/dev/null  ## Generate rsa/dsa keys to login into that remote machine without a password
sleep 2m
ping -c 2 <remote-host>
ssh $user@<remote_host>
So let's know first what you've tried so far.
Quote:
i have tried with chown root:root and chmod 475
What's link of chroot with reboot script? Please be clear.

Last edited by shivaa; 10-29-2012 at 12:29 AM.
 
Old 10-29-2012, 01:36 PM   #8
VDP76
Member
 
Registered: Apr 2010
Location: Bayreuth, Germany
Distribution: CrunchBang Linux (#!)
Posts: 111

Rep: Reputation: 19
hi SIcan,
afaik, reboot command requires root privileges to be launched; but there is a way around it: adding exceptions to /etc/sudoers file, see here for details...
 
Old 10-29-2012, 11:41 PM   #9
SIcan
LQ Newbie
 
Registered: Mar 2011
Posts: 17

Original Poster
Rep: Reputation: 0
Thank you VDP76 for the docs. I will try to the use them.
I know that what the script I look for, is a little special.
The Remote PC accept no incoming connection. it pools the commands from cloud and execute the corresponding script.
 
Old 11-03-2012, 09:44 AM   #10
SIcan
LQ Newbie
 
Registered: Mar 2011
Posts: 17

Original Poster
Rep: Reputation: 0
Thanks for your help,
I have reslve it by passing the password in the script using expect
 
  


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
[SOLVED] Script not running after reboot norwichnick Linux - General 3 04-19-2012 04:35 AM
Make a script run at reboot Braynid Linux - Newbie 10 06-26-2006 11:10 AM
how to script after reboot xcr Linux - General 1 03-06-2006 08:07 PM
startup script when reboot ust Linux - Software 5 09-10-2005 07:19 PM
Bash Script reboot pazvant Programming 1 05-04-2004 06:37 PM


All times are GMT -5. The time now is 08:51 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