473,387 Members | 1,515 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Run Perl Script on Task Sheduler

Hi guys,

I recently start using Perl, so please correct if I say something with no sense :)

I write a script export some data from AD. The script works ok on Windows Server 2003 R2 on Task Sheduler. The script runs ok on Windows Server 2008 when I run it manually, but when I run it by Task Sheduler the create files are empty. The is no error on task log.

On the script I'm using 'system' command, may be because this command ? Can someone help me out ?

Thanks in advance,

Hugo
Dec 16 '10 #1
6 2632
rovf
41
If you suspect system() as the culprit, did you check its return code?
Dec 16 '10 #2
Hi,

I'm a new user on Perl, I just started yesterday. How can I check that ?

Thanks

Hugo
Dec 16 '10 #3
rovf
41
I would just open a file, and append the return value from system() to this file (maybe together with a timestamp and the command to be executed) - provided the value is non-zero.

For creating files see:
perldoc -f open
For writing to a file see:
perldoc -f print
For creating a time stamp see:
perldoc -f localtime
Dec 16 '10 #4
numberwhun
3,509 Expert Mod 2GB
To answer your question about the return code, it would be captured into the special variable: $?

You can read about all the special variables here.

Regards,

Jeff
Dec 16 '10 #5
rovf
41
Well, it is a *return* code after all, so you just take the return value of system(). No need to use $?.
Dec 17 '10 #6
numberwhun
3,509 Expert Mod 2GB
True, was 1/2 asleep when I wrote that. You are correct.


You simple do this:

Expand|Select|Wrap|Line Numbers
  1. my $returncode = system(....);
  2.  
$returncode will contain the return value of system(). If its 0, it worked.

Now, if you are wanting to do something with the system commands you are executing, like use the output of them to do something else in your script, then system() will not work. Instead you will need to use back ticks around the system command.

Regards,

Jeff
Dec 17 '10 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: dpackwood | last post by:
Hello, I have two different scripts that do pretty much the same thing. The main perl script is on Windows. It runs and in the middle of it, it then calls out another perl script that then...
9
by: Martin Foster | last post by:
Hi. I would like to be able to mimic the unix tool 'uniq' within a Perl script. I have a file with entries that look like this 4 10 21 37 58 83 111 145 184 226...
3
by: PzYon | last post by:
Hey 2gether! I'm trying to execute a PERL script on the web server when the user presses a button in an ASP.NET Web Application using Visual Basic. The most obvious solution for me seemed to be...
1
by: Nathan | last post by:
This may be a basic task to some of you perl guru's, but I have a problem getting a perl script i've written, when executed by httpd, to send out an e-mail. Basically, i have a few variables...
7
by: Wladimir Borsov | last post by:
I want to call a perl script myscript.pl in my cgi-bin from a HTML web page. This call should NOT use SSI (because in this case HTTPS://.... protocol is necessary). Furthermore NO button click...
9
by: 8anos | last post by:
Hello, I am new at the community and newbie at programming :) As you may know rapidshare provides a perl script for linux, to upload files at their servers. You can find the original scripts at...
4
by: bir | last post by:
I want to schedule the perl script on windows server but without using windows task schedule services. I want to write my own script which scedules the script and runs periodically on same day may be...
3
by: bossingdarwin | last post by:
Hi Guys, I'm new to Perl and to this forum and I hope you gurus here help me. I am building a perl script that will telnet to one of my cisco router and execute commands. I was able to do this...
82
by: happyse27 | last post by:
Hi All, I modified the user registration script, but not sure how to make it check for each variable in terms of preventing junk registration and invalid characters? Two codes below : a)...
1
by: Ormazd | last post by:
Hello, I was wondering if anyone might be able to help me with a little PERL script? I'm very new and I have been given a task to write a simple Perl script that prints out the file names and...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.