Find the answer to your Linux question:
Results 1 to 4 of 4
Hey Linux pros! I'm currently taking a course which includes Linux however the teacher is terrible at delivering the content and I've done my best to decipher this assignment. Maybe ...
  1. #1
    Just Joined!
    Join Date
    Oct 2009
    Posts
    2

    Cronjob assignment



    Hey Linux pros!

    I'm currently taking a course which includes Linux however the teacher is terrible at delivering the content and I've done my best to decipher this assignment. Maybe I could find better insight from users like yourselves. This is NOT a direct copy/paste of my assignment, I did alot of cleaning up. Anyway, here we go :

    ----------------------------------------------------------------------------------------------
    Linux II – Assignment II Understanding

    PART 1

    Create this cronjob :

    - Create a file in root's home directory.
    - Make that file list all other files that have the setuid bit.
    - Only capture good output. No error messages.
    - This happens once a month on the first day.

    - Give the file a descriptive filename and include date info : Month, Week, Day as part of the filename.
    - Everytime the file is created log the action to a separate log file named /var/log/rootadmin
    - Use facility “user” for logging.
    - Message must be descriptive and contains date/time, host and pid.

    - Extract – using grep – the log entries of the scheduler that pertains to the job you created and save it as a file name ~root/cronlog

    -----------------------------------------------------------------------------------------------------

    Now, I'm not asking for someone to actually do it for me. no.no. I simply wish for help getting started and maybe help me understand what I'm doing. So far, our teacher has VERY briefly touched on Cron and my understanding is quite limited at this point.

    Thanks in advance!

    -JD-

  2. #2
    Linux Engineer Kieren's Avatar
    Join Date
    Aug 2007
    Location
    England
    Posts
    845
    The first thing you need to do is create a script that "list all other files that have the setuid bit." Don't worry about cron for this part

    Once you have created that script you then need to use crontab to run the script at the specified times

    Once you have done that you can edit your crontab again to output your script's output to the logfile

    Finally you can use grep on the log file to search for all the input from your script

    Hope this helps you out a bit!
    Linux User #453176

  3. #3
    Just Joined!
    Join Date
    Oct 2009
    Posts
    2
    Thanks Kieren for your advice! I would absolutely create a script to do this however I cannot for 2 reasons I failed to mention before :

    1. She said this can all be accomplished with 1 command that includes command substitution.

    2. I'd have to learn scripting :P (We're not that far yet )

    I'm devoting the next 3 days on this project to fully understand Cron and command substitution. I'll periodically come back here and post my obstacles.

    Thanks again!

  4. #4
    Just Joined!
    Join Date
    Nov 2009
    Posts
    6
    you can use the find command to get a listing of all files with the setuid bit

Posting Permissions

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