User:Jasonjason/sandbox2: Difference between revisions

From The Urban Dead Wiki
Jump to navigationJump to search
m (typo)
No edit summary
Line 19: Line 19:
  <code><nowiki>sed 's/<br \/>/\n/g' ~/zerglist.txt | grep "Zergs,Zerger" >> ~/UDtoolList.txt</nowiki></code>
  <code><nowiki>sed 's/<br \/>/\n/g' ~/zerglist.txt | grep "Zergs,Zerger" >> ~/UDtoolList.txt</nowiki></code>
  <code><nowiki># grabbin' the RG list</nowiki></code>
  <code><nowiki># grabbin' the RG list</nowiki></code>
  <code><nowiki>curl -d State="UD Tool list" "http://www.ud-malton.info/Rogues_Gallery.cgi" | grep -v "#" > ~/RGlist.txt</nowiki></code>
  <code><nowiki>curl -d State="UD Tool list" "http://www.ud-malton.info/Rogues_Gallery.cgi" | grep -v "#" >> ~/UDtoolList.txt</nowiki></code>
<code><nowiki>cat ~/RGlist.txt >> ~/UDtoolList.txt</nowiki></code>
  <code><nowiki>rm ~/zerglist.txt</nowiki></code>
  <code><nowiki>rm ~/zerglist.txt</nowiki></code>
<code><nowiki>rm ~/RGlist.txt</nowiki></code>


Make the file executable:
Make the file executable:

Revision as of 21:09, 5 March 2010

Daily auto-updating UDtool list on Linux with the RG list and the zerg liste which requires no work on your part once it's set up. Commands that should be typed at the command line start with $ to indicate your command prompt, omit it if copy/pasting commands into your terminal.

Make a folder to house scripts, if you don't already have one:

$ mkdir scripts

And edit your path so that you can run scripts there

$ PATH=$PATH:~/scripts

Copy and paste this and save it as updateUDtool.sh in your scripts folder:

#!/bin/bash
# removing the old list to start
rm ~/UDtoolList.txt
# colors for the lists come first
echo "#00ff64,Zergs
#770000,Wanted
#FF7256,Past PKers" > ~/UDtoolList.txt
# grabbin' the zerg list
wget -O ~/zerglist.txt http://zombies.dementiastudios.org/boards/index.php?topic=12.0
sed 's/<br \/>/\n/g' ~/zerglist.txt | grep "Zergs,Zerger" >> ~/UDtoolList.txt
# grabbin' the RG list
curl -d State="UD Tool list" "http://www.ud-malton.info/Rogues_Gallery.cgi" | grep -v "#" >> ~/UDtoolList.txt
rm ~/zerglist.txt

Make the file executable:

$ chmod +x ~/scripts/updateUDtool.sh

Run it for the first time:

$ ~/scripts/updateUDtool.sh

Now change your UDtool settings to use the new list, called UDtoolList.txt and located in your home folder.

Now, copy paste this to a text editor and save it as updateUDtool.cron in your scripts folder

20 4 * * * ~/scripts/updateUDtool.sh

And type this in your terminal to set that as a cron job:

$ crontab ~/scripts/updateUDtool.cron

Then, your UD tool list will be updated every day at 4:20 am. You can change the time by changing the updateUDtool.cron file. If you found this useful, let me know.