Automatic podcast stuff and crontabs

Not sure if this is the right forum or not…

Here is what I am thinking. I have an RSS feed for my podcast, I edit it manually and then upload it before I go to bed or try to remember, is there anyway I could use a crontab to say take already uploaded rss file with a date code in the name and have it rename it and overwrite the old one everynight at midnight?

so say I have my normal file podcast.xml that the readers hit then I would have podcast-MO-DA-YR.xml that would be renamed and overwrite podcast.xml at midnight for the date specified in the file name.

Is this possible? Sorry if this is in the wrong forum.

Nate MC

Thanks for the response. I totally spaced that crontab could run a shell script.

Sorry to ask stupid questions but I have about 5 minutes of shell scripting experience, I can edit and save them but I have no idea how I would go about writing one that uses variables and dates. Would you mind showing me an example script based around this idea?

I can give you the basiscs, there’s just one part I don’t know how to do. The variable input file - I’m sure there’s a ‘wildcard’ you can use, but I don’t know what it is.

So you’ll need to edit your crontab file. Log into ssh and type “crontab -e”. That will open up the default text editor (nano/pico). Now your crontab entry should look something like:

        • 1,2,3,4,5,6,7 mv /home/user/path/to/file/origional.xml /home/user/path/to/new/podcast.xml

that all needs to appear on one line, without breaks. There need to be a space between each * . that part tells how frequently to run this command - this one is running once a day, 7 days a week. Check out the K-base on crontabs for more explination of the time thing.

You might be able to use *.xml as your wild card - just be sure there’s only one xml file in the directory to begin with, or it will combine them. You can allways test the command to see if it’s working. Just type the part from “mv” on.

Hope this helps


* * * * 1,2,3,4,5,6,7 mv /home/user/path/to/file/origional.xml /home/user/path/to/new/podcast.xml

Please don’t do this. This will run your command 1,440 times per day (ie, every minute).

To run something at midnight every night, you want something like this:

0 0 * * * command or /path/to/script

If you want useful replies, ask smart questions.

Thanks! I’m gonna give it a whirl and I’ll check the kbase on more crontab stuff.

Plus it looks like there is finally a podcast plug-in for wordpress so I might try that too.

Ok, I’ve got my script…

cd /home/natemc/
TODAY=date +"%m-%d-%Y"
mv -f “podcasttest-$TODAY” testpodcast.xml

and it works fine if I type it in manually via SSH running bash, but if I save it as a script file and then try to run it with the command “bash

I get this error
: No such file or directorynatemc/
mv: cannot stat `podcasttest-11-08-2005\r’: No such file or directory

Woops, messed that one up good. Thanks for the correction.

Not sure about your error… sorry.


Do you had on line 1 #!/bin/bash ?
also i think that you can change the move for echo to know what and where is doing…
maybe is ignoring your ‘cd’

hey, thanks for the reply.

Forgot to post back here but I figured it out. It was because I was editing the script on my windows box and then upload it, windows has a different lien return command or whatever so it was screwing it up.

Rewrote it on the server using emacs and everything was fine after that.

thanks again!