get an error typeset: not found when i launch my script by crontab?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I use this portion of code to set default values in my config on my script.sh



typeset -A config # init array
config=( # set default values in config array
# chemin du dossier de log
[log]=$SCRIPTPATH"/logs"
# chemin du dossier local
[local]=""
)


when i launch my script with shell console everything is OK and working
But if I want to schedule launch with crontab i get an error



/var/********/script.sh: 148: /var/********/script.sh: typeset: not found
/var/********/script.sh: 149: /var/********/script.sh: Syntax error: "(" unexpected


here is my crontab line



# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

* * * * * root /var/********/script.sh -c file.conf > /dev/null 2> /var/********/errors.log


can you explain me why ? thanks










share|improve this question









New contributor




J.D is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.















  • 1




    How is your cron job invoking the script? Does the script have a she-bang line?
    – Jeff Schaller
    15 mins ago










  • sorry, i've updated the post
    – J.D
    10 mins ago










  • i'm sorry but i don't know what is she-bang line... I'm a noob on shell scripting
    – J.D
    2 mins ago










  • Is that the entire script? Or is the first line something like #!/bin/sh ?
    – Jeff Schaller
    11 secs ago














up vote
0
down vote

favorite












I use this portion of code to set default values in my config on my script.sh



typeset -A config # init array
config=( # set default values in config array
# chemin du dossier de log
[log]=$SCRIPTPATH"/logs"
# chemin du dossier local
[local]=""
)


when i launch my script with shell console everything is OK and working
But if I want to schedule launch with crontab i get an error



/var/********/script.sh: 148: /var/********/script.sh: typeset: not found
/var/********/script.sh: 149: /var/********/script.sh: Syntax error: "(" unexpected


here is my crontab line



# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

* * * * * root /var/********/script.sh -c file.conf > /dev/null 2> /var/********/errors.log


can you explain me why ? thanks










share|improve this question









New contributor




J.D is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.















  • 1




    How is your cron job invoking the script? Does the script have a she-bang line?
    – Jeff Schaller
    15 mins ago










  • sorry, i've updated the post
    – J.D
    10 mins ago










  • i'm sorry but i don't know what is she-bang line... I'm a noob on shell scripting
    – J.D
    2 mins ago










  • Is that the entire script? Or is the first line something like #!/bin/sh ?
    – Jeff Schaller
    11 secs ago












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I use this portion of code to set default values in my config on my script.sh



typeset -A config # init array
config=( # set default values in config array
# chemin du dossier de log
[log]=$SCRIPTPATH"/logs"
# chemin du dossier local
[local]=""
)


when i launch my script with shell console everything is OK and working
But if I want to schedule launch with crontab i get an error



/var/********/script.sh: 148: /var/********/script.sh: typeset: not found
/var/********/script.sh: 149: /var/********/script.sh: Syntax error: "(" unexpected


here is my crontab line



# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

* * * * * root /var/********/script.sh -c file.conf > /dev/null 2> /var/********/errors.log


can you explain me why ? thanks










share|improve this question









New contributor




J.D is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I use this portion of code to set default values in my config on my script.sh



typeset -A config # init array
config=( # set default values in config array
# chemin du dossier de log
[log]=$SCRIPTPATH"/logs"
# chemin du dossier local
[local]=""
)


when i launch my script with shell console everything is OK and working
But if I want to schedule launch with crontab i get an error



/var/********/script.sh: 148: /var/********/script.sh: typeset: not found
/var/********/script.sh: 149: /var/********/script.sh: Syntax error: "(" unexpected


here is my crontab line



# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

* * * * * root /var/********/script.sh -c file.conf > /dev/null 2> /var/********/errors.log


can you explain me why ? thanks







shell-script cron error-handling typeset






share|improve this question









New contributor




J.D is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




J.D is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 11 mins ago





















New contributor




J.D is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 17 mins ago









J.D

112




112




New contributor




J.D is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





J.D is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






J.D is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







  • 1




    How is your cron job invoking the script? Does the script have a she-bang line?
    – Jeff Schaller
    15 mins ago










  • sorry, i've updated the post
    – J.D
    10 mins ago










  • i'm sorry but i don't know what is she-bang line... I'm a noob on shell scripting
    – J.D
    2 mins ago










  • Is that the entire script? Or is the first line something like #!/bin/sh ?
    – Jeff Schaller
    11 secs ago












  • 1




    How is your cron job invoking the script? Does the script have a she-bang line?
    – Jeff Schaller
    15 mins ago










  • sorry, i've updated the post
    – J.D
    10 mins ago










  • i'm sorry but i don't know what is she-bang line... I'm a noob on shell scripting
    – J.D
    2 mins ago










  • Is that the entire script? Or is the first line something like #!/bin/sh ?
    – Jeff Schaller
    11 secs ago







1




1




How is your cron job invoking the script? Does the script have a she-bang line?
– Jeff Schaller
15 mins ago




How is your cron job invoking the script? Does the script have a she-bang line?
– Jeff Schaller
15 mins ago












sorry, i've updated the post
– J.D
10 mins ago




sorry, i've updated the post
– J.D
10 mins ago












i'm sorry but i don't know what is she-bang line... I'm a noob on shell scripting
– J.D
2 mins ago




i'm sorry but i don't know what is she-bang line... I'm a noob on shell scripting
– J.D
2 mins ago












Is that the entire script? Or is the first line something like #!/bin/sh ?
– Jeff Schaller
11 secs ago




Is that the entire script? Or is the first line something like #!/bin/sh ?
– Jeff Schaller
11 secs ago















active

oldest

votes











Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);






J.D is a new contributor. Be nice, and check out our Code of Conduct.









 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f476575%2fget-an-error-typeset-not-found-when-i-launch-my-script-by-crontab%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes








J.D is a new contributor. Be nice, and check out our Code of Conduct.









 

draft saved


draft discarded


















J.D is a new contributor. Be nice, and check out our Code of Conduct.












J.D is a new contributor. Be nice, and check out our Code of Conduct.











J.D is a new contributor. Be nice, and check out our Code of Conduct.













 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f476575%2fget-an-error-typeset-not-found-when-i-launch-my-script-by-crontab%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

Peggy Mitchell

Palaiologos

The Forum (Inglewood, California)