Re: Script to run on web server

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On December 14, 2003 10:28 am, Mysterons Web Design wrote:
> Hi,
>
> I need to run a script (that I can run via cron) to rename a file from its
> existing name to its new name - but I dont have a clue how to do it - can
> anyone help?
>
> basically I have a file called index.new that I want to become index.html
>
>
> Thanks in advance!
>
> Joe

Hi Joe,
how about something like:
#!/bin/bash
OLD_INDEX=/var/www/html/index.html
NEW_INDEX=/var/www/html/index.new
if [ $NEW_INDEX -a $OLD_INDEX ]; then
  mv -f $NEW_INDEX $OLD_INDEX
fi

If the two files exist, this will force the new file to replace the old file 
leaving only index.html (with the contents of index.new)

-- 
Pete Nesbitt, rhce


-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux