Results 1 to 9 of 9

Thread: UNIX GURU'S -Please Help me please!

  1. #1

    Thread Starter
    PowerPoster Beacon's Avatar
    Join Date
    Jan 2001
    Location
    Pub Floor
    Posts
    3,188

    UNIX GURU'S -Please Help me please!

    Hi,

    I need a bash script to do the following:

    A list of currently running proccess's owned by root!
    Amount of time the machine has been up and load average
    List of all used and unused space on OS partition
    List of all users online(on machine)
    Also if the HD space is below 5% then email send an email to a specified email address or default with date, and username of person who executed this script!

    Then it needs to put all of this into an email and email to an inputted email address and if not entered email to a defualt email address.

    Anyone give me any idea of what to do? PLEASE

    THANKS

  2. #2

    Thread Starter
    PowerPoster Beacon's Avatar
    Join Date
    Jan 2001
    Location
    Pub Floor
    Posts
    3,188
    anyone!!!

  3. #3
    Fanatic Member gwdash's Avatar
    Join Date
    Aug 2000
    Location
    Minnesota
    Posts
    666
    well, if it's being run as root, the ps will give you a list of proccesses being run

    uptime will give you the uptime of the machine

    not sure about load average or freespace, but i know you can

    who will list users, but what you want is probably finger @computername

    use something like this:
    Code:
    #!/path/to/sh
    sendmail -t<<EOF
    echo "To: $1"
    echo "From: root"
    echo "Subject: Status"
    echo "Proccess:"
    echo `/path/to/ps`
    echo `/path/to/uptime`
    echo `/path/to/finger @`/path/to/localhost``
    EOF
    call like this

    scriptname emailaddress
    GWDASH
    [b]VB6, Perl, ASP, HTML, JavaScript, VBScript, SQL, C, C++, Linux , Java, PHP, MySQL, XML[b]

  4. #4
    ps will work no matter what user you are.

  5. #5
    Fanatic Member gwdash's Avatar
    Join Date
    Aug 2000
    Location
    Minnesota
    Posts
    666
    correct, but it will only list the proccess of the current user if called with no options, i don't know what the options are to list proccess for a specific user
    GWDASH
    [b]VB6, Perl, ASP, HTML, JavaScript, VBScript, SQL, C, C++, Linux , Java, PHP, MySQL, XML[b]

  6. #6

    Thread Starter
    PowerPoster Beacon's Avatar
    Join Date
    Jan 2001
    Location
    Pub Floor
    Posts
    3,188
    chers fellas but what if we dont run sendmail?
    Or any mail client i.e howabout if i just want to mail to another user!

    And nope it wont be run as administrator?

    And b4 you ask no it's not for any college assignemnt!
    It's for work and i'm still learning all this stuff!

  7. #7
    Fanatic Member gwdash's Avatar
    Join Date
    Aug 2000
    Location
    Minnesota
    Posts
    666
    how do you send your mail then??

    without sendmail, you have to talk directly to SMTP server(s).

    and i doubt your entire company knows the SMTP protocol like that back of their hand
    GWDASH
    [b]VB6, Perl, ASP, HTML, JavaScript, VBScript, SQL, C, C++, Linux , Java, PHP, MySQL, XML[b]

  8. #8

    Thread Starter
    PowerPoster Beacon's Avatar
    Join Date
    Jan 2001
    Location
    Pub Floor
    Posts
    3,188
    Something like

    "mail" i heard perhaps i'm confused??

  9. #9
    Lively Member
    Join Date
    Jun 2001
    Location
    Banana Republic
    Posts
    115
    Most unix systems will have sendmail

Posting Permissions

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



Click Here to Expand Forum to Full Width