Server Reboots [ AUTOMATIC RESTART SCRIPT ]

Having a problem with your shell account? Post here.

Server Reboots [ AUTOMATIC RESTART SCRIPT ]

Postby Tim on Sat Jun 24, 2006 12:13 pm

Yes, we all hate these things, they kill our processes and are generally just irritating.

So what are we doing about it? Well we have implented a system that will automatically start up programs you specify when the server is rebooted so if you want your psybnc or eggdrop coming back up instantly without running some silly crontab then this is for you.

Ok the first thing to do is create the file .reboot in your home directory
Code: Select all
nano ~/.reboot

Now we have two options, so I'll give examples of how each works.

Command mode:
Code: Select all
# This is an example of a command mode reboot file
/home/tim/eggdrop/eggdrop -m bot.conf
/home/tim/psybnc/psybnc
echo "started my stuff automatically" > /home/tim/reboot_log


Script mode:
Code: Select all
#!/usr/local/bin/php
# ok this is an example of script mode, which is chosen by
# having #! as the first 2 characters in the file.
<?
$home = "/home/tim";

$psybnc = "psybnc/psybnc";
$eggy = "eggdrop/eggdrop -m bot.conf";
$log_file = "reboot_log";
$log_text = "started my stuff automatically";

// start the psybnc
exec($home . '/' . $psybnc);
// start the eggy
exec($home . '/' . $eggy);
// write the log
$file = fopen($home . '/' . $log_file);
$write = fwrite($file, $log_text);
fclose($file);

?>


Then save the file and exit (CTRL + X in nano).

Any questions on using this, just post them here
User avatar
Tim
root
root
 
Posts: 736
Joined: Thu Mar 10, 2005 6:31 am
Location: Australia

Postby Raven on Tue Sep 19, 2006 4:34 am

Sweet code/script. I'll try using these when we get back online. Smile
Raven
Regular
Regular
 
Posts: 140
Joined: Wed Jun 21, 2006 9:22 pm

Postby topolab on Tue Sep 19, 2006 12:54 pm

nice scripts, but i think that is possible to create a php
script for web-admin without ssh Wink
Image -= irc.EFNET.nl : #AIVAnet , #salonica =-
Image -= 0day symbian+pda -> http://aivanet.info =-
topolab
Regular
Regular
 
Posts: 134
Joined: Sun Sep 11, 2005 7:31 am
Location: macedonia-north greece

Postby deags on Wed Sep 27, 2006 1:07 am

probably need to make permissions executable too
deags
Contributer
Contributer
 
Posts: 53
Joined: Fri May 05, 2006 2:37 pm

Postby Tim on Wed Sep 27, 2006 1:21 am

As long as root can read the file theres no problem...which reminds me I really need to find another copy of this script. This is probably one of the better things I've written Very Happy
User avatar
Tim
root
root
 
Posts: 736
Joined: Thu Mar 10, 2005 6:31 am
Location: Australia

Postby deags on Sun Jan 21, 2007 3:53 am

tim have you found a copy?
deags
Contributer
Contributer
 
Posts: 53
Joined: Fri May 05, 2006 2:37 pm

Re: Server Reboots [ AUTOMATIC RESTART SCRIPT ]

Postby atox on Thu Jun 07, 2007 3:08 pm

this script still work?

if yes.. i write in .reboot file

Code: Select all
# This is an example of a command mode reboot file
/home/username/eggdrop/eggdrop -m bot.conf
/home/username/psybnc/psybnc
echo "started my stuff automatically" > /home/tim/reboot_log


is it ok? what is this?
Code: Select all
echo "started my stuff automatically" > /home/tim/reboot_log


thank
atox
Newbie
Newbie
 
Posts: 1
Joined: Sun Jun 03, 2007 10:07 am

Re: Server Reboots [ AUTOMATIC RESTART SCRIPT ]

Postby Joost on Fri Jun 08, 2007 3:03 pm

atox wrote:
is it ok? what is this?
Code: Select all
echo "started my stuff automatically" > /home/tim/reboot_log


thank


I think he writes the text "started my stuff automaticlly" to the text file reboot_log every time the script has been run. (every reboot)
Joost
Newbie
Newbie
 
Posts: 11
Joined: Thu Jun 07, 2007 4:04 pm

Re: Server Reboots [ AUTOMATIC RESTART SCRIPT ]

Postby chris4 on Thu Jul 05, 2007 12:13 am

Hi,
I'm not quite sure what im doing, but would the following work for a sBNC reboot script.

/home/chris4/sbnc/sbnc
echo "started my stuff automatically" > /home/chris4/reboot_log

That is written in the .reboot file I created as above.
Thank you
chris4
Newbie
Newbie
 
Posts: 6
Joined: Wed Jun 27, 2007 12:21 am

Re: Server Reboots [ AUTOMATIC RESTART SCRIPT ]

Postby c0h on Fri Jul 06, 2007 8:24 am

hi

Code: Select all
echo "started my stuff automatically" > /home/chris4/reboot_log

this line simply prints the line "started my stuff automatically" to the file "/home/chris4/reboot_log", for example to make you sure that the reboot script works .. ;)

possibly the reboot script looks this file every time it runs, and if this line is not found, your programs stay offline :)))
but i think its incredible.. ))
nothing can`t be done..
c0h
Newbie
Newbie
 
Posts: 13
Joined: Wed Jun 27, 2007 8:42 am
Location: Russia

Re: Server Reboots [ AUTOMATIC RESTART SCRIPT ]

Postby cowart on Wed Jul 11, 2007 5:59 am

hi

i save this to filenamed .reboot in my home dir on the shell but i think it doesnt work after the reboot of the system my bot still didnt connect,
what i do is manually restart it on the shell. Can anyone tell me what is wrong with my installation of .reboot file?

here is the code....

# This is an example of a command mode reboot file
/home/bot1/cow^bot/eggdrop -m cow^bot.conf
echo "started my stuff automatically" > /home/bot1/reboot_log

thanks.
\__/)
(='.'=) This is Bunny. Copy and paste bunny into your
(" )_(" ) signature to help him gain world domination.
cowart
Contributer
Contributer
 
Posts: 22
Joined: Thu May 17, 2007 3:41 am
Location: Tacloban City, Philippines


Return to Technical Support

Who is online

Users browsing this forum: No registered users and 1 guest

cron