Rename filename inside the crontab file
Hi Team,
i have below file is my crontab, 00 * * * * /home/@@@@/ulimit_nofile_status_20480.sh >> /export/####/$$$$$/ulimit_nofile_status.txt 00 * * * * /home/@@@@/ulimit_nproc_status_20480.sh >> /export/####/%%%%/ulimit_nproc_status.txt i want to change the file name (ulimit_nofile_status_20480.sh and ulimit_nproc_status_20480.sh) to (ulimit_nofile_status_40960.sh and ulimit_nproc_status_40960.sh) these are file names. I want to rename 20480 to 40960 Had tried below commands but did not work for me. 1) crontab -l | sed 's#/_20480\.#/40960.#' | crontab - 2) crontab -l | sed 's/\<_20480\>/40960/' | crontab - |
Why can't you just edit you crontab file directly?
|
i have more than 50 server and i can't do it manually on all the server. so looking out for any command or script which can help me out
|
In sed expression you used #/ as delimiter but it has to be one char, ie with /
Code:
sed 's/_20480/_40960/' |
Code:
crontab -l | sed -r 's/(ulimit_n\w+?status_)20480\.sh/\140960/g' |
Thanks team,
i was able to rename the file name by the below command: ssh $line "crontab -l | sed 's/20480/40960/' | crontab -" |
All times are GMT -5. The time now is 11:58 AM. |