Sponsored Content
Top Forums Shell Programming and Scripting Rescheduling perl script using at command Post 302232080 by DILEEP410 on Wednesday 3rd of September 2008 08:47:49 PM
Old 09-03-2008
Question Rescheduling perl script using at command

Hi,

I have a perl script which accepts a file as input and ftp the file to a particular sever.I scehduled this script at a specific time using crontab.Everything seeems fine if the input file is available under the path.

Now assume due to some reasons the input file is not avaialble by the time the script is scheduled.So obviously the script will fail.

My requirement is, if the input file is not available then reschedule the script after 30 minutes.I tried to implement this logic using 'at' command by including the below statement in the script :

`at now + 30 minutes -f /home/dileepp/scripts/ftp_file.pl 1> /home/dileepp/logs/ftp_file.log 2> /home/dileepp/logs/ftp_file.log`

As i expected the script is rescheduled after 30 minutes,but by the time it is running, the script is parsed or interpreted using 'sh' and not with 'perl'. The shebang line #!/usr/bin/perl is already there in the script.I don't know why it is not picking up the shebang.The error is like this:

sh: line 35: use: command not found
sh: line 36: use: command not found

(throwing error at the 'use' line which is used to include module in perl, and the error is running long in all the perl specific commands)

Can anybody suggests how to make invoke this rescheduling with the perl intrepreter.I checked the man pages of 'at', but no info regarding this.Environment details are as below:

Perl version: 5.8.3
OS: Linux Ubuntu 2.6.15 i686
at version 3.1.9


Your help is appreciated!


With Regards
Dileep Pattayath
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

how can call perl script as command?

Hello say i have written some perl scripts , now i like to call them in my unix shell as unix command like "more" , "ls" , "grep" so that my say perl script called "foo.pl" will be called from every where as "foo" or "foo arg1 arg2"? Thanks (1 Reply)
Discussion started by: umen
1 Replies

2. Shell Programming and Scripting

get command alias name in perl script?

hi all, In my perl script, I need to know the command alias name to make my program flexible. I tried many methods like system("alias cmd"), `alias cmd`, use shell qw,etc. But no one could recognize the built in command alias. If I use `which cmd`, it would look for the command based on... (4 Replies)
Discussion started by: ktmchen
4 Replies

3. Shell Programming and Scripting

[Perl] Accessing array elements within a sed command in Perl script

I am trying to use a script to replace the header of each file, whose filename are stored within the array $test, using the sed command within a Perl script as follows: $count = 0; while ( $count < $#test ) { `sed -e 's/BIOGRF 321/BIOGRF 332/g' ${test} > 0`; `cat 0 >... (2 Replies)
Discussion started by: userix
2 Replies

4. UNIX for Advanced & Expert Users

Crontab Rescheduling

Hi, I want to weekly schedule a script execution (using crontab) but only if the system load is low. My question is: If the script does not be executed ( because of high load ) how can I re-schedule the cronjob to run after some minutes? I want the re-scheduling to be executed until the final... (1 Reply)
Discussion started by: tdakanalis
1 Replies

5. UNIX for Dummies Questions & Answers

Crontab Rescheduling

Hi, I want to weekly schedule a script execution (using crontab) but only if the system load is low. My question is: If the script does not be executed ( because of high load ) how can I re-schedule the cronjob to run after some minutes? I want the re-scheduling to be executed until the final... (1 Reply)
Discussion started by: tdakanalis
1 Replies

6. Shell Programming and Scripting

Crontab Rescheduling

Hi, I want to weekly schedule a script execution (using crontab) but only if the system load is low. My question is: If the script does not be executed ( because of high load ) how can I re-schedule the cronjob to run after some minutes? I want the re-scheduling to be executed until the final... (4 Replies)
Discussion started by: tdakanalis
4 Replies

7. Shell Programming and Scripting

Send "perl -e '...' " command through SSH, from a perl script

Hey guys I am trying to send a perl -e command to a number of systems using SSH. The command should retrieve some information for me. The problem is, the remote shell tries to interpolate my variables and doesn't get it should take the command literally and just execute it. Below the code.... (2 Replies)
Discussion started by: clrg
2 Replies

8. Shell Programming and Scripting

perl script command line option driven script

could someone show me a sample command line option driven script? i want to see an easy way to write one and how i can execute it using command line options such as typing in read.pl -i <id> -c <cmds> -s <start> -e <end> would read out all the commands run by ID . from start time to... (7 Replies)
Discussion started by: kpddong
7 Replies

9. Shell Programming and Scripting

perl/unix: script in command line works but not in perl

so in unix this command works works and shows me a list of directories find . -name \*.xls -exec dirname {} \; | sort -u | > list.txt but when i try running a perl script to run this command my $query = 'find . -name \*.xls -exec dirname {} \; | sort -u | > list.txt';... (2 Replies)
Discussion started by: kpddong
2 Replies

10. Shell Programming and Scripting

Using UNIX command in perl script.

I wish to know if there is any limitation in using unix commands in perl script or it is just we should avoid using them in our perl script. For e.g Below is the command to get the recent file in a dir.: $lcsvFile = `cd "$l_inputfilepath";ls -1t *.CSV|tail -1` Is there any harm in coding... (1 Reply)
Discussion started by: Devesh5683
1 Replies
TAP::Parser::SourceHandler::Perl(3pm)			 Perl Programmers Reference Guide		     TAP::Parser::SourceHandler::Perl(3pm)

NAME
TAP::Parser::SourceHandler::Perl - Stream TAP from a Perl executable VERSION
Version 3.26 SYNOPSIS
use TAP::Parser::Source; use TAP::Parser::SourceHandler::Perl; my $source = TAP::Parser::Source->new->raw( 'script.pl' ); $source->assemble_meta; my $class = 'TAP::Parser::SourceHandler::Perl'; my $vote = $class->can_handle( $source ); my $iter = $class->make_iterator( $source ); DESCRIPTION
This is a Perl TAP::Parser::SourceHandler - it has 2 jobs: 1. Figure out if the TAP::Parser::Source it's given is actually a Perl script ("can_handle"). 2. Creates an iterator for Perl sources ("make_iterator"). Unless you're writing a plugin or subclassing TAP::Parser, you probably won't need to use this module directly. METHODS
Class Methods "can_handle" my $vote = $class->can_handle( $source ); Only votes if $source looks like a file. Casts the following votes: 0.9 if it has a shebang ala "#!...perl" 0.75 if it has any shebang 0.8 if it's a .t file 0.9 if it's a .pl file 0.75 if it's in a 't' directory 0.25 by default (backwards compat) "make_iterator" my $iterator = $class->make_iterator( $source ); Constructs & returns a new TAP::Parser::Iterator::Process for the source. Assumes "$source->raw" contains a reference to the perl script. "croak"s if the file could not be found. The command to run is built as follows: $perl @switches $perl_script @test_args The perl command to use is determined by "get_perl". The command generated is guaranteed to preserve: PERL5LIB PERL5OPT Taint Mode, if set in the script's shebang Note: the command generated will not respect any shebang line defined in your Perl script. This is only a problem if you have compiled a custom version of Perl or if you want to use a specific version of Perl for one test and a different version for another, for example: #!/path/to/a/custom_perl --some --args #!/usr/local/perl-5.6/bin/perl -w Currently you need to write a plugin to get around this. "get_taint" Decode any taint switches from a Perl shebang line. # $taint will be 't' my $taint = TAP::Parser::SourceHandler::Perl->get_taint( '#!/usr/bin/perl -t' ); # $untaint will be undefined my $untaint = TAP::Parser::SourceHandler::Perl->get_taint( '#!/usr/bin/perl' ); "get_perl" Gets the version of Perl currently running the test suite. SUBCLASSING
Please see "SUBCLASSING" in TAP::Parser for a subclassing overview. Example package MyPerlSourceHandler; use strict; use vars '@ISA'; use TAP::Parser::SourceHandler::Perl; @ISA = qw( TAP::Parser::SourceHandler::Perl ); # use the version of perl from the shebang line in the test file sub get_perl { my $self = shift; if (my $shebang = $self->shebang( $self->{file} )) { $shebang =~ /^#!(.*perl.*?)(?:(?:s)|(?:$))/; return $1 if $1; } return $self->SUPER::get_perl(@_); } SEE ALSO
TAP::Object, TAP::Parser, TAP::Parser::IteratorFactory, TAP::Parser::SourceHandler, TAP::Parser::SourceHandler::Executable, TAP::Parser::SourceHandler::File, TAP::Parser::SourceHandler::Handle, TAP::Parser::SourceHandler::RawTAP perl v5.18.2 2014-01-06 TAP::Parser::SourceHandler::Perl(3pm)
All times are GMT -4. The time now is 09:30 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy