LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-17-2005, 02:20 PM   #1
abdul_zu
Member
 
Registered: Feb 2005
Posts: 71

Rep: Reputation: 15
running perl scripts very system start


Hi experts,

I wanted to always keep running one perl script when the system is start till system halted.

Or is there any way to run this script in any other service. so the script will continue running till the service will run.

i was trying with init.d but it is not running.

Thank You
 
Old 08-17-2005, 03:32 PM   #2
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86_64; Gentoo PPC; FreeBSD; OS X 10.9.4
Posts: 3,760
Blog Entries: 4

Rep: Reputation: 78
Usually /etc/init.d/local is where you run programs/scripts etc to be started at boot, when they don't warrant a full-blown initscript. Depending on your distro this file may be elsewhere, but it always has 'local' in the name...
 
Old 08-17-2005, 11:15 PM   #3
abdul_zu
Member
 
Registered: Feb 2005
Posts: 71

Original Poster
Rep: Reputation: 15
Hi,

If you have some kind of another idea. so my script can be run continue from machine start to shut down?


Thank You
 
Old 08-19-2005, 02:44 AM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,369

Rep: Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753
bulliver's answer is correct. Of course, if you tell us which distro you are using, we can be more specific
 
Old 08-19-2005, 02:51 AM   #5
abdul_zu
Member
 
Registered: Feb 2005
Posts: 71

Original Poster
Rep: Reputation: 15
hi,

i am really sorry about distro, what is this can you give me little explain please, i am new in linux so i don't have more information?

Thank You
 
Old 08-20-2005, 07:22 AM   #6
kadhiravan.r
Member
 
Registered: Nov 2004
Location: india/tamil nadu/chennai
Distribution: Linux 8.0
Posts: 37

Rep: Reputation: 15
U can specify your script full path in the /etc/profile.
For emp:
If UR having one perl script in /home/john/test.pl U shoult the path name as

perl /home/john/test.pl in the /etc/profile as above.

It will work

regards

kadhir.r
 
Old 08-20-2005, 07:30 AM   #7
abdul_zu
Member
 
Registered: Feb 2005
Posts: 71

Original Poster
Rep: Reputation: 15
hi kadhir.r,

It is working but when we login fist time. I want to keep it continue running when the system start till he system powe off.

Or if there is any another way to include in another application for the example httpd. if any request comes to httpd the perl script should excute.


Thank you
 
Old 08-20-2005, 07:48 AM   #8
kadhiravan.r
Member
 
Registered: Nov 2004
Location: india/tamil nadu/chennai
Distribution: Linux 8.0
Posts: 37

Rep: Reputation: 15
Specify the script in the crontab file so that it will work until he shutdown the system.


is it ok?

regards

Kadhir.R
 
Old 08-20-2005, 07:52 AM   #9
abdul_zu
Member
 
Registered: Feb 2005
Posts: 71

Original Poster
Rep: Reputation: 15
Hi,

In my knwdladge the crontab will execute in specified time. and the minimum time is 1 minute and i want to run this file within each 2 secnds
 
Old 08-20-2005, 07:57 AM   #10
kadhiravan.r
Member
 
Registered: Nov 2004
Location: india/tamil nadu/chennai
Distribution: Linux 8.0
Posts: 37

Rep: Reputation: 15
No if specify zero (0) in all the field it will work think.
otherwise put the script in the rc?.d file and create apropriate link to the init.d file.

is it ok?

regards.
kadhir.r
 
Old 08-20-2005, 07:59 AM   #11
abdul_zu
Member
 
Registered: Feb 2005
Posts: 71

Original Poster
Rep: Reputation: 15
HI,

Putting zero for all, i already tested not working. but the second option i think it is interested and i hope it will be work.

can u give me little explaination?
 
Old 08-20-2005, 08:06 AM   #12
kadhiravan.r
Member
 
Registered: Nov 2004
Location: india/tamil nadu/chennai
Distribution: Linux 8.0
Posts: 37

Rep: Reputation: 15
that is what ever service handled by xinetd demon the moster script will be in /etc/init.d .The init.d will be linked to the script to be excuted.So u have to specify the path of the script in the master daemon located in /ec/init.d/.

u can check this with any other service that is started from xinetd.


If U got the point i will be happy.


regards

kadhir.r
 
Old 08-20-2005, 08:13 AM   #13
abdul_zu
Member
 
Registered: Feb 2005
Posts: 71

Original Poster
Rep: Reputation: 15
Hi,

Thanx a lot. i got your point. but i don't know how to make the link in init.d.
my original file is under of

/usr/local/cron/update.pl

now how i can make the link. Sorry bro because i am new in linux.

Regards,
 
Old 08-28-2005, 10:00 AM   #14
kadhiravan.r
Member
 
Registered: Nov 2004
Location: india/tamil nadu/chennai
Distribution: Linux 8.0
Posts: 37

Rep: Reputation: 15
Sorry , I am not able to mail U beca'z of my work load.


First U do one thing, put U R shell in /etc/rc.d/rc.local like this

path o U R script &(this will start U R script in the bg U can test it)

like /usr/local/update.pl &




regards


kadhir.R
 
Old 09-22-2005, 03:05 AM   #15
abdul_zu
Member
 
Registered: Feb 2005
Posts: 71

Original Poster
Rep: Reputation: 15
hi kadhiravan,

i am really sorry for delay your reply. actually i was outside of country.

I did check as you discribe it. but it is working only on login to server.

here is the rc.local file where i make the modification.

#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local
/usr/local/cron/update.pl &
=============================
i wanted to run this script continue from system start to shutdown.

I wanted to explain you for which resaion i want to run continusly. i have two table one table is linked with freeradius and i wanted to to insert the record from one table which is linked to radius to another on radius table update.

If you have any another easy way i can use it to solve my problem.
 
  


Reply



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
problems in running cgi/perl scripts... raymond Linux - General 17 02-09-2010 04:06 AM
Running perl scripts outside of cgi-bin ylikone Programming 1 09-08-2005 04:34 AM
Running web based perl scripts in userdirs markham82 Linux - Networking 1 12-15-2004 06:51 AM
running perl scripts une mdk9.l and apache clefler Linux - Software 4 11-15-2003 12:35 PM
Running Perl/CGI scripts hso_sof Linux - Newbie 3 08-22-2003 10:26 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:29 AM.

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
Open Source Consulting | Domain Registration