backup script shell script, help.

Discussion in 'Programming/Scripts' started by nova, Apr 27, 2016.

  1. nova

    nova New Member

    I honestly have no idea where to start or what to do to make this script. If somebody could help me, id really appreciate it!

    Write a shell script called runBackup that takes an unlimited number of arguments that all represent file names.

    The script should send an error message and usage instructions when executed without any arguments to stderr. The script should send an error message to stderr when the file(s) do not exist, but still process the ones that do exist.

    The script will accept a single argument. The argument is a filename that is expected to be a text-file which contains a list of files and/or directories. Your script will read/parse this file, each file listed in the data file will be copied to the directory ~/backup. Your script should also work if the read in file was a directory, in this case it would recursively copy the entire directory (this is done via a option to the cp command).
    1. If the directory ~/backup does not exist, it should be created.
    2. If it does exist (from previous runBackup runs), the current contents should be TAR'd and the contents in ~/backup deleted. The tar should be named as ~/backupXX.tar. Example command to tar and delete a directory: tar -cvf ~/backup01.tar ~/backup --remove-files
    3. The tar filename's XX increments until it finds a tar file that does not exist. For example, the second tar would be named ~/backup02.tar.
    4. Error messages should be output for any file that are unable to be copied, either you do lack access and/or they do not exist.
     
  2. sjau

    sjau Local Meanie Moderator

    well, first you have to decide on what language you wanna use. I'd probably go for bash.
     
  3. nova

    nova New Member

    I forgot to mention that, i am going to code this in bash
     
  4. sjau

    sjau Local Meanie Moderator

Share This Page