Commit 75923d4
committed
Fix cronjobs not setting USER variable
I start ./loop_gdb.sh with a cronjob set in `crontab -e`
it runs as a non root linux user.
But cron does not set the environment variable USER
I could in the `crontab -e` at the top manually do `USER=chiller`
but there is a risk I forget this.
I tested `whoami` instead of `$USER` and it actually seemed to be set.
Also `id` showed the name but I found no flag to only print the name.
So from my quick test it seems like `whoami` is more portable than
then `$USER` variable.
Fixes the following error I got:
rm: remove write-protected regular file '/tmp/_ddpp_build_lock.txt.lock'?
You can see the missing username in front of the leading _
that is because the $USER expanded to the empty string because the
./loop_gdb.sh was started from cron.
Then this file was shared between multiple users and the `mv`
command became interactive. Because the underlying `rm` command
noticed a permissions change.
Could also do a `rm -f` here but the actual issue is that we
shared the lock file for multiple users.1 parent 6dff1ab commit 75923d4
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
0 commit comments