I'm currently working on bash script, that will add jobs to root's crontab. I'm trying to achieve it with command:
sudo crontab -e -u root | { cat; echo "@reboot /home/$CURRENT_USER/scripts/reboot.sh"; } | crontab -
I'm testing this command in shell of Ubuntu Server 18.04 and right after typing password for sudo shell hangs completely. I've tested that several times. Server resources are ok, everything works fine after establishing new ssh connection.
Please help me understand what is wrong with this command and what should I do to make it write something to roots crontab (sudo su doesn't work, because creates new shell, which stops script).