Find the answer to your Linux question:
Results 1 to 2 of 2
Task A: Find all log files (with extension .log) in /var/log (no subdirectories) and copy them to the directory systemlogsOct13 in the home folder of the root user. The suffix ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2010
    Posts
    2

    please help me to write this shell script


    Task A:
    Find all log files (with extension .log) in /var/log (no subdirectories) and copy them to the directory systemlogsOct13 in the home folder of the root user. The suffix Oct13 of the name of the directory should be generated by the script, and represent the date the script is run. If the directory does not exist then create it, otherwise add to the existing contents. Make sure you donít overwrite files with the same name; work with unique names in the systemlogsmmmdd directory.

    Task B:
    (uses the result of Task A)
    Produce a report on screen that holds the following information: The difference in number of files and disk space between the systemlogsmmmdd directory and the log files in the /var/log directory, The number of files in systemlogsmmmdd that had to be renamed when these were copied.
    Then ask the user if the contents of systemlogsmmmdd need to be deleted, and act accordingly. The suffix mmmdd represents the current date, as in Task A. If systemlogsmmmdd does not exist it still produces a report that makes sense.

    Task C:
    Find all files within the /home folder (including subfolders), belonging to a chosen user that are not in that userís home folder. The chosen userís name is to be prompted and entered from the keyboard. Verify that the user's name is not empty, and that the user's home folder exists. If the userís name is username, you may assume that the userís home folder is /home/username, if it exists.

    Task D:
    Create a compressed tar archive of a chosen userís home folder, and save this file in the /home directory. Make sure the name of the archive relates uniquely to this user. Add to the file called archivestats in /home information about the number of files in the tar archive, and the size of the archive before compression. If archivestats does not exist then create it, otherwise append to the existing contents. After archivestats has been updated it should be presented on screen, one page at a time. The chosen userís name is to be prompted and entered from the keyboard. Verify that the user's name is not empty, and that the user's home folder exists. If the userís name is username, you may assume that the userís home folder is /home/username, if it exists.

  2. #2
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,392
    Sorry, homework questions are not allowed by the forum rules.
    http://www.linuxforums.org/forum/lin...ums-rules.html

    But here you should find explanation and examples of all tools neded for your tasks.
    Advanced Bash-Scripting Guide
    You must always face the curtain with a bow.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •