raspberry pi - Raspbian: Reset Bash environment variables -


i trying crontab working on raspberry pi , think messed environment variables. can execute file gui right-clicking , choosing execute. cannot same file run command line. can use ls see file (chrometab.sh), when type chrometab.sh, "bash: chrometab.sh: command not found".

i think messed environment variables when put in crontab.

shell=/bin/sh path=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin 

i followed examples in script doesn't run via crontab works fine standalone.

any idea i'm doing wrong?

update: ok, let me clarify efforts took on part before posting question on stackoverflow before getting anymore downvotes.

first of s. adam nissley suggestions. in answer steps listed above. running home path, or qualified path not work stated. error: bash: chrometab.sh: command not found

./chrometab.sh 

i have ensured read/write , execute permissions on file with

chmod +x ./chrometab.sh 

also, bash script starts off following shebang

#!/bin/sh 

so, i'm trying is, regardless of using crontab or not issue @ hand can not execute script command line. started happening after messing around environment variables in crontab. i'm looking way revert situation can @ least run/execute bash commands terminal.

the way can execute script (right-click execute) through gui.

assuming in same directory script, should able enter

./chrometab.sh 

if not execute, make sure executable command

chmod +x ./chrometab.sh 

or

chmod 755 ./chrometab.sh 

and if still won't execute, make sure has appropriate hashbang on first line of script #!/bin/sh or #!/bin/bash


when add crontab, make sure has full path like

/home/pi/bin/chrometab.sh  <br/> 


edit: default path , shell raspbian
can check path , shell environmental variables command line follows:

echo $shell echo $path 

the default path rasbian is:

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games 

and default shell is:

/bin/bash 

so if need set simple as:

path=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games shell=/bin/bash 


if having other issues environment, may want disable of local settings see if problem in profile. can list files ls -a, includes hidden files. raspbian typically has .bashrc , .profile in each user's home directory. disable them simple rename them:

mv .bashrc .bashrc_disabled mv .profile .profile_disabled 

if solves problem, can inspect files , make necessary corrections before renaming them original names.


Comments

Popular posts from this blog

jquery - How do you format the date used in the popover widget title of FullCalendar? -

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -