Skip to main content
tags
Source Link
thanasisp
  • 8.5k
  • 2
  • 29
  • 40

I'm currently working on bash script, that will add jobs to rootsroot'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).

I'm currently working on bash script, that will add jobs to roots 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).

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).

Source Link

I cannot echo job to root's crontab with sudo - shell hangs

I'm currently working on bash script, that will add jobs to roots 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).