10-13-2005
problem with a script and the cron
hello
I use a script to give me the number of users, at each hour.
this script read a file where there is the number of users for each hour and for each month (so 12 files per year).
If i execute the script (root), it is ok, i have xxx users for each hour.
if I put the script in the cron (crontab -e), and kill the cron, the planification is right, the script is executed, but I have "0" user as result for each hour !
I have verified the file's permissions, and chmod 777 for each file, but it's same !!!
can you help me ?
thank you
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I've written a csh shell script to number each line of a file.
Firstly, the program count the number of the file and create a file with number at the front. Then, combine the file together.
when i call the program manually, it works.However, when i set it in the cronjob, the output always leaves... (3 Replies)
Discussion started by: fung_donald
3 Replies
2. Shell Programming and Scripting
Hello All,
One of my shell scripts was working fine till a few days back. It was scheduled in the cron. But yesterday i made some modifications to the script. The script works fine when i run it from the prompt. But it is not working when in runs from cron. Can someone help me out from this. (4 Replies)
Discussion started by: Raiden
4 Replies
3. Shell Programming and Scripting
Hi!
I just write a simple script to kill-restart a process, but when I use CRON to run it, it runs fine for about 1 minute (kill the process and restart it)... then the new process just dissapears!. 5 minutes later (cron prog time) and it does again... up process the disspaear ...
This is the... (0 Replies)
Discussion started by: Sorrento
0 Replies
4. Shell Programming and Scripting
Hi;
I'm facing the problem with my script like below
30 0 * * * /data/SCRIPT/LOADLOGS/loadata1.sh 2 1 >> /tmp/loaddata.txt
loadata1.sh calling a another 2 scripts which we need to exe in sequence.
when it perform by cron jon, sometimes it just can process 20 recs or less or nothing but... (6 Replies)
Discussion started by: izai
6 Replies
5. UNIX for Dummies Questions & Answers
Hello,
I have problem in executing a shell script. When the shell script is executed at the shell prompt the script works successfully but when the same script is run as a cron job it fails to execute the files called within the shell script.
I have scheduled the job in my crontab file as
... (6 Replies)
Discussion started by: forumthreads
6 Replies
6. UNIX for Dummies Questions & Answers
Hi,
Before I start, I would like to inform that, I went through all FAQs and other threads before posting here.
I 'm trying to schedule a shell script on cygwin using cron. No matter what I do I don't seem to get the cron job executing my bash script.
My script is temp.sh
echo `date` >... (4 Replies)
Discussion started by: shash
4 Replies
7. Shell Programming and Scripting
Hi,
I have a shell script as below:
ORACLE_HOME=/usr/local/opt/oracle/product/dev
export ORACLE_HOME
PATH=$PATH:$ORACLE_HOME/bin:/usr/bin
export PATH
OUTFILE=/export/home/`basename $0`.out
export OUTFILE
export IDEN
df -k . | tail -1 | read a b c d e f
echo $a >> $OUTFILE
echo $b... (4 Replies)
Discussion started by: Abhinav Pandey
4 Replies
8. UNIX for Dummies Questions & Answers
Hi Newbie here
I am having problems with automating sFTP transfers.
Just to save time - SCP is not an option as sFTP is stipulated by controllers of far end server.
Ineed to automate sFTP transfer of a single file, once a day to a remote server to which i have no control over.
I am using:... (6 Replies)
Discussion started by: robbien
6 Replies
9. Shell Programming and Scripting
When i am working with cron i given the command as crontab - e | grep runjob.sh.I though my command is wrong and i closed it by ctrl+D.After that when i need to open the cron with crontab -e its not opening its giving some number 22667 and when i given crontab -l its working fine i can see all... (5 Replies)
Discussion started by: bhas85
5 Replies
10. UNIX for Dummies Questions & Answers
Hello gurus,
I am making what I think is a simple db2 call from within a shell script but I am having difficulty producing the desired
report when I run the script shown below from a shell script in cron. For example, my script and the crontab file setup
is shown below:
#!/bin/ksh
db2... (3 Replies)
Discussion started by: okonita
3 Replies
at(1) General Commands Manual at(1)
Name
at, batch - execute commands at a later time
Syntax
at time [day] [file]
at -r job...
at -l [job...]
batch [file]
Description
The and commands use a copy of the named file (standard input default) as input to or at a later time. A command to the current directory
is inserted at the beginning, followed by assignments to all environment variables. When the script is run, it uses the user and group ID
of the creator of the copy file.
The command allows the user to specify when the commands should be executed, while jobs queued with execute when the load level of the sys-
tem permits.
The environment variables, current directory, and are retained when the commands are executed. However, open files, traps, and priority
are lost.
Users are permitted to use the and commands if their name appears in the file If that file does not exist, the file is checked to determine
if the user should be denied access to and If neither file exists, only the superuser is allowed to submit a job. If only the file exists
and is empty, global usage is permitted. The files consist of one user name per line.
The time is 1 to 4 digits. It can, but does not have to be, followed by A, P, N or M which stand for AM, PM, noon or midnight, respec-
tively. The A, P, N, and M suffixes are case-insensitive. One and two digit numbers are interpreted as hours, three and four digits to be
hours and minutes. If three digits are specified, the first digit is interpreted to be an hour in the range 0-9, and the second and third
digits as minutes. If no letters follow the digits, a 24 hour clock time is presumed.
In addition to 1-4 digits, and suffixes A, P, M, N, you can also specify:
at hh:mm
at h:mm
at ham
at hpm
at noon
at midnight
The optional day is either a month name followed by a day number or by a day of the week. If the word week follows, the or command is
invoked in seven days. Both commands also recognize standard abbreviations for the days of the week and months of the year. The following
are examples of legitimate commands:
at 8am jan 24
at 1530 fr week
The programs are executed by periodic execution of the command from The granularity of depends upon how often atrun is executed. The com-
mand examines the file every minute. The file determines when is executed. The default is every 15 minutes on the 1/4 hour. Editing makes
run more or less frequently.
Standard output or error output is lost unless it is redirected.
The and commands write the job number to standard error.
Options
-r Removes jobs previously scheduled by or The number is the number reported at invocation by or Only the superuser is
allowed to remove another user's jobs.
-l Lists all job numbers for all jobs submitted by the user issuing the command. Even if the user is "root", only numbers
for jobs submitted by "root" are displayed. To see the numbers of all jobs submitted, enter the following command:
% ls -l /usr/spool/at
Restrictions
Due to the granularity of the execution of there may be bugs in scheduling jobs almost exactly 24 hours into the future.
Diagnostics
Complains about various syntax errors and times that are out of range.
Files
/usr/lib/atrun executor run by cron(8)
in /usr/spool/at:
yy.ddd.hhhh.* activity for year yy, day dd, hour hhhh.
lasttimedone last hhhh
past activities in progress
/usr/spool/at/at.allowlist of allowed users
/usr/spool/at/at.denylist of denied users
/usr/spool/at spool directory
/usr/lib/cron XOPEN compatibility
See Also
crontab(5), cron(8)
at(1)