centos - Launch perl script on startup -


i'm trying launch perl script supposed run time on startup.

i'm working on centos server.

i added line in /etc/rc.d/rc.local , script won't start while works when type same line console :

perl /svcmon/bin/svcperf.pl --svc fav01svc --interval 5 >> /dev/null & 

this script supposed launched , have wait many time want datas inserted in database, adding

>> /dev/null/&  

allows keep on using machine while script working in background.

i don't know because don't why doesn't work...

do have idea of try ?

edit : turns out managed launch script doing :

nohup /usr/bin/perl /svcmon/bin/svcperf.pl --svc fav01svc --interval 5 > /outputsvcperf.txt &

but doesn't work because postgresql server isn't launched in time while supposed launched on startup , before perl script...

  1. in unix shell (where command works) type command: "which perl"

    this produce output giving full path perl binary. let's example returns "/bin/perl"

  2. in rc.local script, change "perl your-command" "/bin/perl your-command" (basically replace perl qualifying name). (hat/tip @choroba noticing in comments).

    this because, on command line, have $path set up, lets unix shell find commands reside in path. when rc scripts run, don't have path set them shell, , therefore don't know search commmands.

  3. incidentally, not problem, change ">>/dev/null" ">/dev/null". don't append null device, output it.

references:


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -