Posted On January 12, 2021

Linux: How to Add a Line into Crontab from Command Line

kimconnect 0 comments
blog.KimConnect.com >> Linux >> Linux: How to Add a Line into Crontab from Command Line

The easy method:

newline=@reboot /usr/bin/numlockx
(crontab -l && echo "$newLine") | crontab -

Alternative (longer version) of adding a line to crontab:

crontab -l > tempCron # copy crontab to a new file
echo "$newLine" >> tempCron #echo new cron into cron file
crontab tempCron # Replace crontab with tempCron
rm tempCron

Original (manual) version of installing numlock:

sudo crontab -e
### add this line ###
echo "@reboot /usr/bin/numlockx" >> /usr/bin/crontab

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

Uhhuh. NMI received for unknown reason 3d on CPU 4

Problem: Message from syslogd@linux03 at Aug 31 04:28:21 ... kernel:[273033.123489] Uhhuh. NMI received for unknown…

How To Install Rancher Onto a Kubernetes Cluster

Step 1: Add Rancher Repo into Helm Source: https:// rancher.com/docs/rancher/v2.x/en/installation/install-rancher-on-k8s/ # Add Rancher repo helm…

Experimental selinux Settings

enable or disable selinux: vim /etc/sysconfig/selinux   setsebool -P httpd_read_user_content 1   grep nginx /var/log/audit/audit.log |…