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...
in unix shell (where command works) type command: "
which perl
"this produce output giving full path perl binary. let's example returns "
/bin/perl
"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.incidentally, not problem, change "
>>/dev/null
" ">/dev/null
". don't append null device, output it.
references:
- https://serverfault.com/questions/268674/why-does-rc-local-require-absolute-paths-how-can-i-run-a-script-at-startup-that
- https://serverfault.com/questions/297527/how-to-test-etc-rc-d-rc-local-to-make-sure-a-command-will-start-successfully-at
- http://www.centos.org/docs/5/html/installation_guide-en-us/s1-boot-init-shutdown-run-boot.html
Comments
Post a Comment