All Questions
13 questions
3
votes
2
answers
221
views
How to handle a missing environment variable set in `crontab`
I have a bash script that I need to be able to start from either:
cron
an interactive (logon) shell
This script needs to know whether it was started from cron, or started from an interactive shell. ...
0
votes
1
answer
267
views
openSUSE Tumbleweed: How do I get sudo crontab -u root -e to open the root crontab in nano instead of vi?
Just wondering the above.
So far I've tried:
export EDITOR=$(which nano)
export SUDO_EDITOR=$(which nano)
export VISUAL=$(which nano)
in both ~/.bashrc and /root/.bashrc, as well as
Defaults ...
0
votes
1
answer
661
views
sudo crontab notify-send doesn't work
I have read similar posts here, here, here and here that mentioned some environment variables DISPLAY and DBUS_SESSION_BUS_ADDRESS. Setting them at the top of my user crontab enabled notify-send to ...
1
vote
1
answer
620
views
How Set ENV Variable Using crontab for All Users?
I'm trying to set an ENV variable in a crontab every so often to change the session_secret. Using both ruby and bash, I can't seem to get out of the sandboxed environments that they use. I need to ...
0
votes
1
answer
901
views
Setting EDITOR variable causes "E886: Can't rename viminfo file" when editing Crontab
I use Vim as my editor.
I wanted to have syntax colouring when editing Crontab with crontab -e.
I followed this answer. After setting variable EDITOR=vim and exporting it crontab -e now shows syntax ...
0
votes
1
answer
726
views
bash script does not work as expected through crontab
im working with sun Solaris 10 which legacy system, I have made a script that handles specific producer and it consists of bash/perl/posix/sqlplus/awk around 1k lines and it works fine in standalone ...
0
votes
1
answer
794
views
crontab cannot find environment variable even after sourcing .bashrc
crontab -e
00 00 * * * /home/username/run.sh >> /home/username/log 2>&1
Inside run.sh:
source /home/username/.bashrc
java
When crontab job is triggered, I got this error in the log:
/...
0
votes
1
answer
1k
views
awscli can't see environment variables but only from cron?
I'm setting up a docker container which requires a cronjob to do a backup using awscli (authenticated via environment variables).
Since cron doesn't see my docker variables I'm printing them to a ...
2
votes
3
answers
5k
views
get Cron to run in the same environment as I get with ssh login
I've a script that runs fine when I ssh to my ubuntu EC2 instance and run it (as the user ubuntu)
I want this to happen when the server boots, so I added it to cron as:
@reboot sleep 10 && /...
5
votes
2
answers
1k
views
permanently setting vim as the $EDITOR for crontab
I am trying to tell my terminal to use vim instead of vi when editing crontab by executing export EDITOR=vim. But closing the terminal and opening a new one just resets the session. How do I change ...
2
votes
2
answers
9k
views
How to set SHELL=/bin/bash globally for cron
With BASH_ENV assigned in /etc/environment I noticed that it doesn't affect cron jobs.
I figured out that having SHELL=/bin/bash in a users' crontab does the trick! Yes! If I simply add (to the ...
1
vote
0
answers
127
views
Master environment script based on $LOGNAME to run on any shell invocation
Dealing with a nice list of Linux (and Solaris) servers, I find that 90% of my users need the same environment variables with a few specifics unique for an individual user.
My goal is to eliminate ...
4
votes
1
answer
35k
views
Users home path in a bash script
I'm writing a bash-script that will be run as a cron job everyday. Very basic, I was wanting to change the wallpaper daily. I have mint-14 with mate.
The thing I'm getting caught up on right now ...