LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-31-2013, 02:02 PM   #1
!! hack-back !!
Member
 
Registered: Nov 2009
Posts: 183

Rep: Reputation: 2
crontab question


hello minds,
i want to rename file every 10th in the month
and then restart service
can i do it with cron tab and how ??
thank you
 
Old 03-31-2013, 02:31 PM   #2
sag47
Senior Member
 
Registered: Sep 2009
Location: Raleigh, NC
Distribution: Ubuntu, PopOS, Raspbian
Posts: 1,899
Blog Entries: 36

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
Look at the man 5 page for crontab in the terminal. It will tell you how scheduling works.
Code:
man 5 crontab
This would be best handled by writing a script which gets called every 10th of the month.
Code:
#run somescript at 3am on the 10th day of every month.
0 3 10 * * /path/to/somescript

Last edited by sag47; 03-31-2013 at 02:33 PM.
 
Old 04-01-2013, 01:16 AM   #3
eklavya
Member
 
Registered: Mar 2013
Posts: 636

Rep: Reputation: 142Reputation: 142
Code:
#!/bin/bash
mv /path/of/the/file /same/path/with/new/name
service start service-name
If you want to rename multiple files of same directory, you can use reg-exp like this,
Code:
Removing all blank space with rename command:
$ rename "s/ *//g" *.mp3
To remove .jpg file extension:
$ rename 's/\.jpg$//' *.jpg
To convert all uppercase filenames to lowercase:
$ rename 'y/A-Z/a-z/' *
To Remove a String from a filename:
$ rename 's/\\//g' *
and use crontab mentioned by sag47.
 
  


Reply



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
Crontab Question ballistic509 Debian 4 12-22-2006 05:27 PM
Crontab Question systemhackerz Red Hat 4 06-28-2006 12:02 AM
crontab question mmoor Fedora 5 05-20-2006 03:50 PM
Crontab question stefaandk Linux - Newbie 1 06-21-2005 07:31 AM
Crontab Question linear Linux - Software 4 01-11-2003 02:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 11:15 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration