I'm assuming this is the gnome-terminal
started from your cronjob.
There is absolutely no need to run the cronjob scripts inside gnome-terminal
. Doing so would mean that the jobs would fail if gnome-terminal
could not be opened (which would probably happen if you weren't using the desktop at the time).
Just use
0 0,6,12,18 * * * "$HOME"/bin/updates.sh
0 0,6,12,18 * * * "$HOME"/bin/rclone.sh
Any output from the scripts will be emailed to you, assuming local email delivery was enabled. To save the output to a log file, use a redirection:
0 0,6,12,18 * * * "$HOME"/bin/updates.sh >>"$HOME"/updates.log"
0 0,6,12,18 * * * "$HOME"/bin/rclone.sh >>"$HOME"/rclone.log"
The environment that the cronjobs are running in is different from the one you usually have when logged in through a graphical desktop environment. For one thing, your default shell may not be set in the SHELL
environment variable, which is why gnome-terminal
starts /bin/sh
instead of bash
(sh
is bash
on your system, but runs in POSIX compatibility mode when invoked as sh
).
When logged in on the graphical desktop environment, opening gnome-terminal
as usual would give you your default shell. If it doesn't, it's because there's a gnome-terminal-server
process running which was started by the cron jobs. Terminate this process by either rebooting or by using pkill -f gnome-terminal-server
.
See also the comment posted by JdeBP below.
grep $(whoami) /etc/passwd
andcat ~/.bashrc
using the formatting tools. – dessert Jul 04 '18 at 12:03sh-4.4
would be to have symlinkedbash
to/bin/sh
(so that bash is invoked assh
, with the-norc
switch) - you'd also need to have changed your terminal profile to use/bin/sh
to observe this. Please check you terminal profile settings (in particular the "use custom command" settings) and add the output ofls -l /bin/sh
to your question – steeldriver Jul 04 '18 at 12:12SHELL=/bin/sh
- I still think you may have symlinked/bin/sh
tobash
for that to result in the prompt stringsh-4.4$
though (ifsh
weredash
the default prompt would be a simple$
) – steeldriver Jul 04 '18 at 12:32whoami
? – Jul 04 '18 at 12:48$whoami
is empty. – orschiro Jul 04 '18 at 12:520 0,6,12,18 * * * /usr/bin/gnome-terminal -e "bash -c '/home/orschiro/bin/updates.sh';bash"
– orschiro Jul 04 '18 at 12:54ls -l /bin/bash
ii) what happens if you just runbash
after opening the terminal and iii) the output ofecho $PS1
. – terdon Jul 04 '18 at 13:56whoami
, not$whoami
. The$
that damadam used was supposed to represent the shell`s prompt. – Kusalananda Jul 04 '18 at 14:13