What's new

[SOLVED] Cronjob parse error

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

octopus

Part of the Furniture
I get parse error when execute script with cronjob but not with ssh.
Code:
Apr 28 18:44:01 crond[863]: user octopus: parse error at down
Apr 28 18:44:01 crond[863]: user octopus: parse error at *19
Get error with cronjob
Code:
cru a myfile down "0 *18 * * * /jffs/myfile.sh down"
But not with ssh
Code:
cru a myfile down "0 *18 * * * /jffs/myfile.sh down

I use myfile.sh down/up
what have i missed in this config?

Octopus
 
I see no space between "*" and "18". That's not a valid parameter.
 
I see no space between "*" and "18". That's not a valid parameter.
Thanks

I have set space between * and 18 and crone is execute.
But i still have parse error.
i use myfile.sh down to execute my .sh file
Code:
Apr 29 11:00:01 crond[863]: user octopus: parse error at down
Code:
case "$1" in
  down)
       content 1
    ;;

  down-1)

       content 2
    ;;

    up)

       content 3
    ;;

    up-1)

       content 4
    ;;

     *)
 
Check that it somehow didn't get changed to DOS/Windows format with carriage returns.

dos2unix myfile.sh
 
Check that it somehow didn't get changed to DOS/Windows format with carriage returns.
dos2unix myfile.sh

I always make my script with Notepad++ with EOL-conversion to Unix.

Thanks
 
I know it's only a code snip....but did you close your 'case' selection with an 'esac'?
 
I know it's only a code snip....but did you close your 'case' selection with an 'esac'?
Yes i have this in end of script.
Code:
 echo "usage: $0 {down : down-slow | up : up-slow}"
  exit 0
esac
 
Got it!

The syntax of your "cru" command is wrong and putting rubbish in the crontab

Code:
# cru a myfile down "0 *18 * * * /tmp/zzz.sh down"

# cru l
30 6 * * * /sbin/service restart_wireless #RestartWireless#
00 6 * * * /jffs/scripts/adblock.sh /tmp/mnt/VERBATIM/ASUS #AdBlock#
down 0 *18 * * * /tmp/zzz.sh down #myfile#

# tail /tmp/syslog.log
Apr 30 01:46:01 crond[382]: user admin: parse error at down
Apr 30 01:46:01 crond[382]: user admin: parse error at *18

Try this:
Code:
cru l

then use "cru d myfile" to delete the incorrect entry, then

cru a myfile-down "0 18 * * * /jffs/myfile.sh down"
 
Last edited:
Got it!

The syntax of your "cru" command is wrong and putting rubbish in the crontab

Code:
# cru a myfile down "0 *18 * * * /tmp/zzz.sh down"

# cru l
30 6 * * * /sbin/service restart_wireless #RestartWireless#
00 6 * * * /jffs/scripts/adblock.sh /tmp/mnt/VERBATIM/ASUS #AdBlock#
down 0 *18 * * * /tmp/zzz.sh down #myfile#

# tail /tmp/syslog.log
Apr 30 01:46:01 crond[382]: user admin: parse error at down
Apr 30 01:46:01 crond[382]: user admin: parse error at *18

Try this:
Code:
cru l

then use "cru d myfile" to delete the incorrect entry, then

cru a myfile-down "0 18 * * * /jffs/myfile.sh down"

TANK YOU!!!

Thats working just fine, no more parse error. Can use up and down now.
Must use Hyphen (between myfile and down.)

Code:
Apr 30 13:46:01 crond[863]: crond: USER octopus pid 8656 cmd /jffs/configs/wanblock.sh down
Apr 30 13:50:01 crond[863]: crond: USER octopus pid 8720 cmd /jffs/configs/wanblock.sh up


Octopus
 
Last edited:

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top