Visit Our UNIX and Linux User Community


perl process loop isn't running


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting perl process loop isn't running
# 8  
Old 09-01-2009
I assume that you have a Platform.pm available somewhere on your system. There are a few ways to include it, but the easiest in my view is to add the following at the top of your script...
Code:
#!/usr/bin/perl -w

BEGIN {
push @INC, "<directory containing Platform.pm>";
}
.
.

This dynamically adds the directory to the @INC variable before any of the main code runs and makes it clear what you're doing. You can do the same thing by adding a -I option on the command line but then you have to invoke Perl explicitly rather than just executing your .pl script
# 9  
Old 09-01-2009
Quote:
Originally Posted by avronius
It appears that you are missing a perl module or two...

Code:
line 9#    use Platform;
line 10#   use Platform::Queue;
line 11#   use Platform::Video;

they are there, though I'm not sure what "missing in @INC" means because they are in the same directory as the aws-daemon

would it say its missing if the process wasn't running?

the only thing that happened at the same time this occured was the data center where this is hosted experienced an outage
# 10  
Old 09-01-2009
Having them listed in your perl script is not the same as having the modules installed on your system somewhere.

The @INC is a list of directories where perl will look to find these modules.
Code:
(@INC contains:
/etc/perl
/usr/local/lib/perl/5.8.8
/usr/local/share/perl/5.8.8
/usr/lib/perl5
/usr/share/perl5
/usr/lib/perl/5.8
/usr/share/perl/5.8
/usr/local/lib/site_perl
.)

It wouldn't hurt to run a simple command to see if the file exists and is simply not in the path:
Code:
find / -name Platform.pm -print

# 11  
Old 09-02-2009
Quote:
Originally Posted by JerryHone
I assume that you have a Platform.pm available somewhere on your system. There are a few ways to include it, but the easiest in my view is to add the following at the top of your script...
Code:
#!/usr/bin/perl -w

BEGIN {
push @INC, "<directory containing Platform.pm>";
}
.
.

This dynamically adds the directory to the @INC variable before any of the main code runs and makes it clear what you're doing. You can do the same thing by adding a -I option on the command line but then you have to invoke Perl explicitly rather than just executing your .pl script
Yes, Platform.pm is on the system

I don't really want to add the @INC variable at this time because I'm completely sure what even caused the perl process to stop, if it was due to the network outage then thats fine I just want to know that I'm not trying to initiate something that had been terminated because of another problem in the system.

I thought I had a disaster recovery plan so that I could reboot the system entirely myself in a matter of a few short steps but I think we blew that off or forgot about it. My sysadmin is off onto another adventure and unreachable so I'm trying my best to not do more harm than good.

---------- Post updated at 04:39 PM ---------- Previous update was at 04:25 PM ----------

Quote:
Originally Posted by avronius
It wouldn't hurt to run a simple command to see if the file exists and is simply not in the path:
Code:
find / -name Platform.pm -print

i ran that and its in the same directory

/same/path/to/aws-daemon

How does @INC provide the path, in other words it looks like it provides the path to

/etc/perl
/usr/local/lib/perl/5.8.8
/usr/local/share/perl/5.8.8
/usr/lib/perl5
/usr/share/perl5
/usr/lib/perl/5.8
/usr/share/perl/5.8
/usr/local/lib/site_perl

So shouldn't the /same/path/to/Platform.pm be in that list

---------- Post updated at 04:56 PM ---------- Previous update was at 04:39 PM ----------

Ok, so I ran:

Code:
perl -e "print join(\"\n\", @INC);"

and the /path/to/Platform.pm is not in the results this is all thats there:

/etc/perl
/usr/local/lib/perl/5.8.8
/usr/local/share/perl/5.8.8
/usr/lib/perl5
/usr/share/perl5
/usr/lib/perl/5.8
/usr/share/perl/5.8
/usr/local/lib/site_perl

Is it possible that when the reboot occured it upgraded to 5.8.8 and wiped the @INC array clean?

If thats the case, then this /path/to/Platform.pm may just be one of many that are now missing in the @INC array, so if I just manually add it back in via command line as:

Code:
perl -I /path/to/Platform.pm

Now I also see a Platform.pm.old in the same directory but not sure if that is of any help.

---------- Post updated at 08:03 PM ---------- Previous update was at 04:56 PM ----------

I tried doing the perl -I command and it didn't seem to add it to the @INC list

---------- Post updated at 09:57 PM ---------- Previous update was at 08:03 PM ----------

Ok another discovery Smilie

when I login to root with su the /Platform.pm and the /aws.conf are not there

is that what the problem is? when I'm logged in as a regular user they are there.

---------- Post updated 09-02-09 at 03:39 PM ---------- Previous update was 09-01-09 at 09:57 PM ----------

Quote:
Originally Posted by JerryHone
I assume that you have a Platform.pm available somewhere on your system. There are a few ways to include it, but the easiest in my view is to add the following at the top of your script...
Code:
#!/usr/bin/perl -w

BEGIN {
push @INC, "<directory containing Platform.pm>";
}
.
.

This dynamically adds the directory to the @INC variable before any of the main code runs and makes it clear what you're doing. You can do the same thing by adding a -I option on the command line but then you have to invoke Perl explicitly rather than just executing your .pl script
Added the following to the top of the script, which worked.

Code:
use lib '/path/to/modules';


Previous Thread | Next Thread
Test Your Knowledge in Computers #883
Difficulty: Easy
A computer security vulnerability is a weakness in design, implementation, operation or internal control.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Command to get exact tomcat process I am running ignoring other java process

Team, I have multiple batchjobs running in VM, if I do ps -ef |grep java or tomcat I am getting multiple process list. How do I get my exact tomcat process running and that is unique? via shell script? (4 Replies)
Discussion started by: Ghanshyam Ratho
4 Replies

2. UNIX for Advanced & Expert Users

Process remians in Running state causing other similar process to sleep and results to system hang

Hi Experts, I am facing one problem here which is one process always stuck in running state which causes the other similar process to sleep state . This causes my system in hanged state. On doing cat /proc/<pid>wchan showing the "__init_begin" in the output. Can you please help me here... (6 Replies)
Discussion started by: naveeng
6 Replies

3. BSD

Process remians in Running state causing other similar process to sleep and results to system hang

Hi Experts, I am facing one problem here which is one process always stuck in running state which causes the other similar process to sleep state . This causes my system in hanged state. On doing cat /proc/<pid>wchan showing the "__init_begin" in the output. Can you please help me here... (0 Replies)
Discussion started by: naveeng
0 Replies

4. Shell Programming and Scripting

Bash Question: HowTo Exit Script with User Input While Process is Running Mid-Loop?

Hi, I have written a script that allows me to repetitively play a music file $N times, which is specified through user input. However, if I want to exit the script before it has finished looping $N times, if I use CTRL+c, I have to CTRL+c however many times are left in order to complete the loop.... (9 Replies)
Discussion started by: hilltop_yodeler
9 Replies

5. Linux

X Window isn't running

X Window isn't working. When I ran startx I got an error message as shown in file attachment xwndow.png Accordingly, I removed /tmp/.X0-lock as reflecting in the attchment. Then again I ran the command and 2 more commands (shown in the attachment xwndow1.png) but they failed too. Any... (2 Replies)
Discussion started by: ravisingh
2 Replies

6. Shell Programming and Scripting

loop when process running

Hi Gurus, Could you please help me to create a shell script that will be started by a cron job once every night at 24.00 h (that should bee easy:)) The shell script should control every 30 seconds the name of a process, and when the process doesn't run anymore it should execute a few further... (12 Replies)
Discussion started by: blackwire
12 Replies

7. Shell Programming and Scripting

script to monitor process running on server and posting a mail if any process is dead

Hello all, I would be happy if any one could help me with a shell script that would determine all the processes running on a Unix server and post a mail if any of the process is not running or aborted. Thanks in advance Regards, pradeep kulkarni. :mad: (13 Replies)
Discussion started by: pradeepmacha
13 Replies

8. Shell Programming and Scripting

infinite loop to check process is running

Hi, I got a simple script working to check if a process is running and then email if it is not running anymore. My scenario is that I need to make sure the process is always running so instead of running the below script via cron I think it is better to a have a looping script to check... (12 Replies)
Discussion started by: yabai
12 Replies

9. UNIX for Dummies Questions & Answers

perl scripting for checking if a process is running

Hi All, I am new to perl and have been trying to write a short script to check a process.Though i havent reached to the stage where i can match the output. I am trying to pass a variable x with value /opt/RGw/csbp-base/CSBP_BAT.01.00.05/csbp_BAT.01.00.05.jar and then pass another variable... (2 Replies)
Discussion started by: pistachio
2 Replies

10. Shell Programming and Scripting

perl problem - why isn't 'die' being called?

last week i started learning perl, so have limited skill and knowledge. why isn't 'die' being called and the script exiting before the 'directory created' line? if (! -d "$logdir") { system "mkdir -p $logdir" || die print "\nERROR: release log directory creation failed - $logdir: $!\n";... (4 Replies)
Discussion started by: mjays
4 Replies

Featured Tech Videos