LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 02-04-2006, 02:42 AM   #1
semaja2
LQ Newbie
 
Registered: Jan 2006
Posts: 14

Rep: Reputation: 0
BASH :Reading the crontab, and editing it


Hey, i was wondering how would i make a BASH script view the crontab file, read the times for each line and only select the lines that are idetified some how

The main idea for it is, i want this bash script to be able to control certain part of the crontab so it can be a manager for a bunch of backupscripts i have coded
 
Old 02-04-2006, 04:05 AM   #2
twantrd
Senior Member
 
Registered: Nov 2002
Location: CA
Distribution: redhat 7.3
Posts: 1,438

Rep: Reputation: 52
Post what you have and we'll help you out from there.

-twantrd
 
Old 02-04-2006, 07:25 AM   #3
semaja2
LQ Newbie
 
Registered: Jan 2006
Posts: 14

Original Poster
Rep: Reputation: 0
well i dont exactly have anything yet, and im only new to bash but i thought it would nice to be able to make something that is useful, i have some ideas for it but if anyone can point me to some cmds or guides that would be helpful

PS someone writing it is also good since i can read through it and find how it was made
 
Old 02-04-2006, 04:28 PM   #4
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
Try looking at sed. If you use the -i option you can modify the files in place. Are you familiar with regular expressions? That will be of GREAT help regardless of how you go about this or what you need to get done. Are you trying to add/remove lines, or just edit what each line says? Adding and removing lines can be done with cat, head, tail, grep, and >> using temporary files.
ta0kira
 
Old 02-05-2006, 06:43 AM   #5
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: FreeBSD, Debian, Mint, Puppy
Posts: 3,290

Rep: Reputation: 174Reputation: 174
I would say,
don't mess around with your crontab file directly.
it's not a good idea.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using crontab in a bash script nro Linux - Newbie 3 08-26-2005 08:04 PM
editing crontab djgerbavore Slackware 12 05-30-2005 09:24 PM
editing /etc/shells to only allow bash omg-ffs Linux - Newbie 3 12-05-2004 03:20 PM
bash: reading a particular line seb3579 Linux - Newbie 2 09-14-2004 03:01 AM
bash script for database searching using crontab saurya_s Linux - Software 5 01-22-2004 08:53 AM


All times are GMT -5. The time now is 04:39 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration