No output from install script in Linux crontab

When executed from the CLI or another script, the output of the installation script can be redirected. But it seems that something about the install script doesn't allow redirection when executed by crontab.

Objective:
I would like to send a desktop notification with Joplin version information when crontab executes the installation script. However, from crontab, the script outputs nothing.

Original script, per the current FAQ:

wget -O - https://raw.githubusercontent.com/laurent22/joplin/dev/Joplin_install_and_update.sh | bash -s -- --argument1 --argument2

My WIP:

  1. A script executed by crontab executes the Joplin installation script and redirects the output to a variable.
joplin="$(wget -q -O - https://raw.githubusercontent.com/laurent22/joplin/dev/Joplin_install_and_update.sh | bash -s -- --prerelease | grep version | tail -1 | sed -r 's/\x1B(\[[0-9;]*[JKmsu]|\(B)//g')"

The grep and tail commands redirect the line with the new/current version. However, when installing/updating, wget still displays a progress bar with -q added, apparently because it applies only to downloading the .sh.

And the sed command strips color and control codes so notify-send sends only printable characters. The downloaded .sh does not appear to have an option to disable color, and TERM=vt100 and TERM=vt220 prevent the script from running.

  1. The script sends a desktop notification:
DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$(id -u)/bus" notify-send --hint int:transient:5 "$(echo -e $joplin)"

Therefore, I request that the installation .sh:

  1. be modified to enable its output to be redirected when executed by crontab.
  2. output the installed/updated version on the last line (to remove the need for "grep verison").
  3. pass -q to the wget that downloads the latest version.
  4. execute on TERM=vt100 or vt220.

[Linux Mint 20.1, Cinnamon 4.8.6, notify-send 0.7.9]

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.