Sponsored Content
Full Discussion: Command syntax error in cron
Top Forums UNIX for Advanced & Expert Users Command syntax error in cron Post 303015417 by migurus on Wednesday 4th of April 2018 02:59:40 PM
Old 04-04-2018
Command syntax error in cron

SCO OSR 507, user's shell is old Bourne sh
The same command is OK when run using now, but fails when run in cron, see below:

1) using now, see how it worked and I see resulting DT=2018 in the mail
Code:
 
 $ at now
{ dt=`/usr/gnu/bin/date '+%Y'`; echo "DT=$dt"; }
job 1522867418.a-6605:0 at Wed Apr  4 11:43:38 2018
$ mail
SCO OpenServer Mail Release 5.0.7  Type ? for help.
"/usr/spool/mail/test": 1 message 1 new
>N  1 cron@test.testdo Wed Apr  4 19:43   19/639   Output of one of your cron 
& 
Message  1:
From cron Wed Apr  4 18:43:43 2018
Return-Path: <cron>
... snipped for brevity ...
Subject: Output of one of your cron jobs
Date: Wed, 4 Apr 2018 11:43:42 -0700 (PDT)
Status: R
 DT=2018

2) using cron
Code:
 
 $ crontab -l
 44 11 * * * { dt=`/usr/gnu/bin/date '+%Y'`; echo "DT=$dt"; }
 $ mail
 $ mail
SCO OpenServer Mail Release 5.0.7  Type ? for help.
"/usr/spool/mail/test": 1 message 1 new
>N  1 cron@test.testdo Wed Apr  4 19:44   19/696   Output of one of your cron 
& 
Message  1:
From cron Wed Apr  4 18:44:01 2018
Return-Path: <cron>
Received: (from cron@localhost)
...
Subject: Output of one of your cron jobs
Date: Wed, 4 Apr 2018 11:44:00 -0700 (PDT)
Status: R
 /bin/sh: syntax error at line 1: `end of file' unexpected
 
*************************************************
Cron: The previous message is the standard output and standard error
     of the following cron job, executed on your behalf:
{ dt=`/usr/gnu/bin/date '+
&

Please let me know what can be the problem here
Thanks in advance
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

until command syntax error

Hi there. I spent too much time away from Unix, now I can't remember how to issue a simple until command in ksh :mad: could you tell me what is wrong with the following code sample: export v = "1" until do echo 'executing repeat_until' v = `expr $v + 1` done I've... (3 Replies)
Discussion started by: 435 Gavea
3 Replies

2. Shell Programming and Scripting

if else command syntax error

can anyone tell me what`s going wrong with my if else statement? set exam=(AAA BBB CCC) foreach ii ($exam) if ($ii -eq "AAA") do echo "PASS" else echo "FAILED" done end (4 Replies)
Discussion started by: c0384
4 Replies

3. Shell Programming and Scripting

Cron job giving error while running SSH command

Hi All, The script which i am using to SSH to remote server is working fine when i run is using ./ but when cron runs it it gives error that "ssh: not found" please help!!! (3 Replies)
Discussion started by: visingha
3 Replies

4. Solaris

please review this cron syntax

Dears if i want to run this job every Saturday at 6 AM that will be the code * 6 * * 1 cd /export/home/jenova ; ls -ltr >> $HOME/jenova_dir (2 Replies)
Discussion started by: jenovaux
2 Replies

5. Shell Programming and Scripting

bash syntax error: command not found

I am trying to create a shell that asks the user to enter their name, and compare it to my own by saying we have the same name or saying my name and that they have a nice name too. Here is my script... #!/bin/bash-x echo "Enter your name". read name if then echo "My name is Adam too"... (1 Reply)
Discussion started by: amaxey45
1 Replies

6. Shell Programming and Scripting

Syntax error using do command

i have the following do command: while IFS =: read printer drv IP port do echo -e "$ printer: \ n \ drv: \ t $ drv \ n \ IP: \ t $ IP \ n \ port: \ t $ port \ n \" done < diffs.txt receiving the following error: syntax error at line 37 : `do' unmatched something is... (2 Replies)
Discussion started by: ggoliath
2 Replies

7. Shell Programming and Scripting

Syntax error piping to bc on command line - works when assigned to var

I have a script which outputs some timing data a line at a time. There are approx. 10 lines echoed, each line looks something like this: 0.741 http://checkip.dyndns.org 94.170.119.226Since I needed to add all the values in the first column, I piped the output to grep, matching and printing the... (7 Replies)
Discussion started by: gencon
7 Replies

8. Shell Programming and Scripting

Getting syntax error while running awk command

Hello Gurus, I am firing the below command : df -g | grep -v var| awk '{ (if $4 > 90% ) print "Filesystem", $NF,"over sized";}' But I am getting the below error:- ====== syntax error The source line is 1. The error context is {if ($4 > >>> 90%) <<< awk: The... (9 Replies)
Discussion started by: pokhraj_d
9 Replies

9. Shell Programming and Scripting

Syntax error with ps command

i am trying the blow command in vain on Linux Terminal. kill -9 `ps -eaf | grep weblogic.NodeManager | grep wls103 | awk '{print $2}'` kill: usage: kill pid | jobspec ... or kill -l kill -9 $(ps -eaf | grep weblogic.NodeManager | grep wls103| awk '{print $2}') kill: usage: kill pid |... (7 Replies)
Discussion started by: mohtashims
7 Replies

10. Shell Programming and Scripting

(standard_in)1:syntax error using bc with Cron

I created a shell script to record server temperature. When I manually run script it works fine with no error message. But when I create a cron job, my script fails with error message (standard_in)1:syntax error. I figured out the bc utility is causing the error message. Below is my script. ... (7 Replies)
Discussion started by: SysAdminRialto
7 Replies
queuedefs(4)							   File Formats 						      queuedefs(4)

NAME
queuedefs - queue description file for at, batch, and cron SYNOPSIS
/etc/cron.d/queuedefs DESCRIPTION
The queuedefs file describes the characteristics of the queues managed by cron(1M). Each non-comment line in this file describes one queue. The format of the lines are as follows: q.[njobj][nicen][nwaitw] The fields in this line are: q The name of the queue. a is the default queue for jobs started by at(1); b is the default queue for jobs started by batch (see at(1)); c is the default queue for jobs run from a crontab(1) file. njob The maximum number of jobs that can be run simultaneously in that queue; if more than njob jobs are ready to run, only the first njob jobs will be run, and the others will be run as jobs that are currently running terminate. The default value is 100. nice The nice(1) value to give to all jobs in that queue that are not run with a user ID of super-user. The default value is 2. nwait The number of seconds to wait before rescheduling a job that was deferred because more than njob jobs were running in that job's queue, or because the system-wide limit of jobs executing has been reached. The default value is 60. Lines beginning with # are comments, and are ignored. EXAMPLES
Example 1: A sample file. # # a.4j1n b.2j2n90w This file specifies that the a queue, for at jobs, can have up to 4 jobs running simultaneously; those jobs will be run with a nice value of 1. As no nwait value was given, if a job cannot be run because too many other jobs are running cron will wait 60 seconds before trying again to run it. The b queue, for batch(1) jobs, can have up to 2 jobs running simultaneously; those jobs will be run with a nice(1) value of 2. If a job cannot be run because too many other jobs are running, cron(1M) will wait 90 seconds before trying again to run it. All other queues can have up to 100 jobs running simultaneously; they will be run with a nice value of 2, and if a job cannot be run because too many other jobs are running cron will wait 60 seconds before trying again to run it. FILES
/etc/cron.d/queuedefs queue description file for at, batch, and cron. SEE ALSO
at(1), crontab(1), nice(1), cron(1M) SunOS 5.10 1 Mar 1994 queuedefs(4)
All times are GMT -4. The time now is 12:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy