Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

497
Views
How can I remove the particular line in crontab?

below mentioned script has my crontab running functions.

# Chef Name: binary_log_purge 0 */4 * * * /engineyard/bin/binary_log_purge -q
# Chef Name: database_oom_score
*/30 * * * * /engineyard/bin/database_oom_adj
# Chef Name: logrotate -f /etc/logrotate.d/stats 0 * * * * logrotate -f /etc/logrotate.d/stats
# Chef Name: cpu_utilaisation
*/5 * * * * cd /tmp && sh cpu_util.sh >> cpu_utilaisation.log
# Chef Name: Test_script
*/2 * * * * cd /tmp && sh test.sh >> tests_cript.log

The above mentioned query i want to remove the blow line

# Chef Name: Test_script
*/2 * * * * cd /tmp && sh test.sh >> tests_cript.log

How can i remove the function with below mentioned steps:

Step 1 : first i want to find the below line is there or not. How can i find out?

*/2 * * * * cd /tmp && sh test.sh >> tests_cript.log

Step 2 : If the line is there. I want to remove the function. How can i remove the function ?

Please help me.....

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

According to man 5 crontab the crontab files are not intended to be edited directly.

What you can do is run crontab -l, filter out the line using grep -v, run crontab -r to clear the crontab then pipe the modified version of the crontab file into crontab -.

over 4 years ago · Santiago Trujillo Report

0

You can use grep -A 1 'Chef Name: Test_script' | grep -v "^#" to get the line after Test_script but ignoring commented out lines.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!