hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Hosting Security and Technology : CentOS - Add perl script to system startup
Reply

Hosting Security and Technology Configuring and optimizing web hosting servers and operating systems, developing administration scripts, building servers, protecting against hackers, and general security (SSL certificates, etc.)
Forum Jump

CentOS - Add perl script to system startup

Reply Post New Thread In Hosting Security and Technology Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 09-17-2007, 01:54 AM
ThatScriptGuy ThatScriptGuy is offline
Web Hosting Master
 
Join Date: Feb 2003
Location: AR
Posts: 2,370

CentOS - Add perl script to system startup


I need to have assp run on system startup, since my server seems to be suffering from random reboots.

I need to run the command perl /usr/share/assp/assp.pl when the system turns on, so that it will receive mail and I can send mail..

Anybody?

Kevin

Reply With Quote


Sponsored Links
  #2  
Old 09-17-2007, 01:58 AM
voidSecurity voidSecurity is offline
WHT Addict
 
Join Date: Oct 2006
Location: arizona/romania
Posts: 140
echo "perl /usr/share/assp/assp.pl 2>&1 & " >> /etc/rc.d/rc.local

Best Regards

__________________
System Administration *nix - ngnix,clustering solutions Mail

Reply With Quote
  #3  
Old 09-17-2007, 02:02 AM
ThatScriptGuy ThatScriptGuy is offline
Web Hosting Master
 
Join Date: Feb 2003
Location: AR
Posts: 2,370
I already had perl /usr/share/assp/assp.pl in etc/rc.d/rc.local, but the script still doesn't start..

what does the 2>&1 & do?

Kevin

Reply With Quote
Sponsored Links
  #4  
Old 09-17-2007, 02:04 AM
voidSecurity voidSecurity is offline
WHT Addict
 
Join Date: Oct 2006
Location: arizona/romania
Posts: 140
2>&1 redirects stderr to stdout
& puts it in the background

__________________
System Administration *nix - ngnix,clustering solutions Mail

Reply With Quote
  #5  
Old 09-17-2007, 02:04 AM
ThatScriptGuy ThatScriptGuy is offline
Web Hosting Master
 
Join Date: Feb 2003
Location: AR
Posts: 2,370
Thanks for the info!

Kevin

Reply With Quote
  #6  
Old 09-17-2007, 02:09 AM
ThatScriptGuy ThatScriptGuy is offline
Web Hosting Master
 
Join Date: Feb 2003
Location: AR
Posts: 2,370
Nope - still not running on startup....

I'm very confused as the rc.d/rc.local was how I tried to do it when I first got the box, but it never worked...I thought I just had the syntax wrong...

any other ideas?
Kevin

Reply With Quote
  #7  
Old 09-17-2007, 02:17 AM
voidSecurity voidSecurity is offline
WHT Addict
 
Join Date: Oct 2006
Location: arizona/romania
Posts: 140
ok. lets try something else.

nano /etc/init.d/assp
Code:
#!/bin/bash

PATH=/bin:/usr/bin:/sbin:/usr/sbin

case "$1" in

    start)
        echo -n "Starting"
        cd /usr/share/assp
        perl assp.pl
    ;;

    stop)
        echo -n "Stopping"
        kill -9 `ps ax | grep "perl assp.pl" | grep -v grep | awk '{ print $1 }'`
    ;;

    restart)
        $0 stop || true
        $0 start
    ;;

    *)
    echo "Usage: /etc/init.d/assp {start|stop|restart}"
    exit 1
    ;;

esac

exit 0
chmod +x /etc/init.d/assp
echo " /etc/init.d/assp start &> /dev/null " /etc/init.d/rc.local

__________________
System Administration *nix - ngnix,clustering solutions Mail

Reply With Quote
  #8  
Old 09-17-2007, 02:35 AM
david510 david510 is offline
Web Hosting Master
 
Join Date: Oct 2004
Location: Kerala, India
Posts: 4,617
Have you made sure the file /usr/share/assp/assp.pl has got permission 755?

__________________
David | www.cliffsupport.com
Affordable Server Management Solutions sales AT cliffsupport DOT com
iWebManager | Access WHM from iPhone and Android

Reply With Quote
  #9  
Old 09-17-2007, 11:21 AM
ThatScriptGuy ThatScriptGuy is offline
Web Hosting Master
 
Join Date: Feb 2003
Location: AR
Posts: 2,370
The permissions on the file are fine. I can run it manuallly (and have been since I got the box) but now it's becoming inconvenient to have no mail until I start assp.

I'll try your script in just a sec voidsecurity...hopefully it works..

Kevin

Reply With Quote
  #10  
Old 09-17-2007, 11:26 AM
ThatScriptGuy ThatScriptGuy is offline
Web Hosting Master
 
Join Date: Feb 2003
Location: AR
Posts: 2,370
Still nothing. I can now run /etc/init.d/assp start, and it starts beautifully, but it's still not doing it on startup....

This is weird.

Reply With Quote
  #11  
Old 09-17-2007, 11:47 AM
ThatScriptGuy ThatScriptGuy is offline
Web Hosting Master
 
Join Date: Feb 2003
Location: AR
Posts: 2,370
Fixed it!

I changed /etc/rc.d/rc.local to run /etc/init.d/assp start and assp is FINALLY starting when the system starts..

Thanks for all your help void...

Reply With Quote
  #12  
Old 09-17-2007, 06:08 PM
Adam-AEC Adam-AEC is offline
Web Hosting Master
 
Join Date: Feb 2003
Location: Canada
Posts: 935
Quote:
Originally Posted by kcackler View Post
Fixed it!

I changed /etc/rc.d/rc.local to run /etc/init.d/assp start and assp is FINALLY starting when the system starts..

Thanks for all your help void...
Using chkconfig would of worked as well.

ie. chkconfig --levels 12345 assp on

You'll also want to look in one of the other threads regarding ASSP. It has a tendency to die randomly (not often tho) and there is a script you can run to restart it if it dies.

Reply With Quote
Reply

Related posts from TheWhir.com
Title Type Date Posted
Web Host Rackspace Adds FreeBSD 9, CentOS 6.3 Support to Cloud Servers Web Hosting News 2012-07-30 12:47:10
Web Host ServerPronto Donates Hosting Resources to CentOS Web Hosting News 2012-07-05 14:06:27
Peak Hosting Offers Subsidized Hosting Services to Startups Web Hosting News 2012-05-31 12:21:44
Web Host Liquid Web Donates $10,000 to The Perl Foundation Web Hosting News 2011-09-23 18:45:40
Web Host NetHosting Announces Support for CentOS 6 Web Hosting News 2011-07-05 20:15:20


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

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

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?