Linux.com

Digiza

Digiza

  • Linux.com Member
  • Posts: 11
  • Member Since: 07 Apr 10
  • Last Logged In: 12 May 11

Latest Posts

Posted by
Topic
Post Preview
Posted
  • Digiza
    RE: Bash scripting assistance needed please.
    I feel like a Grade A dunce:blink: , Thanks alot, worked perfectly mfillpot.B)
    Link to this post 12 May 11

    I feel like a Grade A dunce:blink: , Thanks alot, worked perfectly mfillpot.B)

  • Digiza
    Bash scripting assistance needed please.
    Hey there Guys / Girls, I am busy doing 100 different things and configurations on one of my systems and as such I have had places where folders and paths were not existing / missing. So I wrote this little guy to let me know. [code] FOLDERS="/u01/stuffs/data /u01/stuffs/music /u01/stuffs/information" for f in $FOLDERS do echo "$f" if [[ -d "${f}" ]] ; then echo "WOHOO its there" echo "" fi echo "Bummer no path like that." echo "" done[/code] Now I am adding it to a little bash applet where it will load various things. one being this script. BUT heres the issue. How can i get the FOLDERS variable to read from a file. so for instance have a folders.txt with all the paths listed in it, then my variable Folders will just be a read of that entire file. everywhere i can find something they are always read 1 line to 1 variable, and thats where im stuck, I would like to keep it 1 variable. somehow....... Thanks for any assists.
    Link to this post 12 May 11

    Hey there Guys / Girls,

    I am busy doing 100 different things and configurations on one of my systems and as such I have had places where folders and paths were not existing / missing.

    So I wrote this little guy to let me know.

     FOLDERS="/u01/stuffs/data
    /u01/stuffs/music
    /u01/stuffs/information"
    for f in $FOLDERS
    do
    echo "$f"
    if [[ -d "${f}" ]] ; then
    echo "WOHOO its there"
    echo ""
    fi
    echo "Bummer no path like that."
    echo ""
    done

    Now I am adding it to a little bash applet where it will load various things. one being this script. BUT heres the issue.

    How can i get the FOLDERS variable to read from a file.
    so for instance have a folders.txt with all the paths listed in it, then my variable Folders will just be a read of that entire file.

    everywhere i can find something they are always read 1 line to 1 variable, and thats where im stuck, I would like to keep it 1 variable. somehow.......

    Thanks for any assists.

  • Digiza
    issues with script for diskspace and mail monitor
    Hi there guys / Girls, I really seem to only ever post issues on here... :( anyways, I hope someone can assist, I found a script to do a Diskspace monitor and notification using shell scripting. but when I try run it I keep getting a error, First off Im utilizing Red-Hat 5.3 and I am using the script using the root account. [code=shell] #!/bin/sh # Shell script to monitor or watch the disk space # It will send an email to $ADMIN, if the (free avilable) percentage # of space is >= 80% # set admin email so that you can get email ADMIN="Oracle.support@saoutsourcing.com" # set alert level 80% is default ALERT=80 df -H | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 }' | while read output; do #echo $output usep=$(echo $output | awk '{ print $1}' | cut -d'%' -f1 ) partition=$(echo $output | awk '{ print $2 }' ) if [ $usep -ge $ALERT ]; then echo "System Running low on Disk space \"$partition ($usep%)\" on $(hostname) as on $(date)" | mail -s "Alert: Almost out of disk space $usep" $ADMIN fi done [/code] the Error I get is [code=linux] bash: ./DiskSpace_Alert.sh: /bin/sh^M: bad interpreter: No such file or directory [/code] but when looking the /bin/sh does exist
    Link to this post 27 Jan 11

    Hi there guys / Girls,

    I really seem to only ever post issues on here... :(

    anyways, I hope someone can assist,
    I found a script to do a Diskspace monitor and notification using shell scripting.

    but when I try run it I keep getting a error, First off Im utilizing Red-Hat 5.3 and I am using the script using the root account.

    [code=shell]
    #!/bin/sh
    # Shell script to monitor or watch the disk space
    # It will send an email to $ADMIN, if the (free avilable) percentage
    # of space is >= 80%
    # set admin email so that you can get email
    ADMIN="Oracle.support@saoutsourcing.com"
    # set alert level 80% is default
    ALERT=80
    df -H | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 }' | while read output;
    do
    #echo $output
    usep=$(echo $output | awk '{ print $1}' | cut -d'%' -f1 )
    partition=$(echo $output | awk '{ print $2 }' )
    if [ $usep -ge $ALERT ]; then
    echo "System Running low on Disk space \"$partition ($usep%)\" on $(hostname) as on $(date)" |
    mail -s "Alert: Almost out of disk space $usep" $ADMIN
    fi
    done
    [/code]

    the Error I get is
    [code=linux]
    bash: ./DiskSpace_Alert.sh: /bin/sh^M: bad interpreter: No such file or directory
    [/code]

    but when looking the /bin/sh does exist

  • Digiza
    RE: Mounting Linux Share location
    Hi mfillpot thanks that gave me the info I needed, sorry for the late responce to this.
    Link to this post 27 Jan 11

    Hi mfillpot thanks that gave me the info I needed, sorry for the late responce to this.

  • Digiza
    RE: Mounting Linux Share location
    Hey Guys/Girls sorry for the LONG as responce time on this one. Been busy studying got to write exams soon. OK I figure that one error now having issues [code] [root@mz-backup /]# /bin/mount -tsmtbfs -o username=sao,password=Passw0rd //172.16.213.12/Backup_Windows/ /mz-pine_temp/ mount: fs type smtbfs not supported by kernel [/code] How the monkeys you find the right tag line for the -t option? Thanks, sorry Im being a ass I know.
    Link to this post 09 Dec 10

    Hey Guys/Girls sorry for the LONG as responce time on this one.
    Been busy studying got to write exams soon.

    OK I figure that one error now having issues


    [root@mz-backup /]# /bin/mount -tsmtbfs -o username=sao,password=Passw0rd //172.16.213.12/Backup_Windows/ /mz-pine_temp/
    mount: fs type smtbfs not supported by kernel

    How the monkeys you find the right tag line for the -t option?

    Thanks, sorry Im being a ass I know.

  • Digiza
    Mounting Linux Share location
    Aloha all, one of these days I’m going to get the handle on Linux.... I’m having a issue, I am busy creating a backup process for a 2 way backup to happen. Currently a windows machine is backing up a location from a linux server. Now I want to have the Linux system back it up for a overlay period, so busy creating cronjobs etc etc.. Now issue is when I want to mount the location. I took the mount command I’m using out of the .sh I created with the logins and cp commands etc, and tested it but still no dice. What I’m getting is this. [code=Linux][root@mz-backup root]# /bin/mount -t smbfs -o username=,password= //mz-server1/Backup_Windows/backup /mzpine/ Could not resolve mount point /mzpine/ [root@mz-backup root]#[/code] Also tried replacing the servername with its IP same issue. I can ping the IP from this machine no issues. Any suggestions / Help would be greatly appreciated. Thanks in advance.
    Link to this post 01 Nov 10

    Aloha all,

    one of these days I’m going to get the handle on Linux....


    I’m having a issue, I am busy creating a backup process for a 2 way backup to happen.
    Currently a windows machine is backing up a location from a linux server.


    Now I want to have the Linux system back it up for a overlay period, so busy creating cronjobs etc etc..
    Now issue is when I want to mount the location.
    I took the mount command I’m using out of the .sh I created with the logins and cp commands etc, and tested it but still no dice.

    What I’m getting is this.

    [code=Linux][root@mz-backup root]# /bin/mount -t smbfs -o username=<userName>,password=<Password> //mz-server1/Backup_Windows/backup /mzpine/
    Could not resolve mount point /mzpine/
    [root@mz-backup root]#[/code]

    Also tried replacing the servername with its IP same issue.
    I can ping the IP from this machine no issues.


    Any suggestions / Help would be greatly appreciated.


    Thanks in advance.

  • Digiza
    RE: [Resolved] ARG..... HELP PLEASE c:bob.txt filename
    Thanks jabirali, Was just going to log on to ask about that system function :) kept trying "pwd/c:osaso_security_rules.txt" and was giving strange errors :P forgot the $ Thanks though, -For everyones interest this works 100% alows moving and renaming without giving you errors.
    Link to this post 29 May 10

    Thanks jabirali,

    Was just going to log on to ask about that system function :)

    kept trying "pwd/c:osaso_security_rules.txt" and was giving strange errors :P

    forgot the $

    Thanks though,
    -For everyones interest this works 100% alows moving and renaming without giving you errors.

  • Digiza
    [Resolved] ARG..... HELP PLEASE c:bob.txt filename
    Hi Guys / Girls, Im in serious need of assistance here, and Im hoping there is a solution thats relatively easy from the command terminal not gui interface.... I had a ^#$(^(#$^%&($ user generate a SQL script with a windows path and filename, and lovely SQL just converted it to one HUGE filename in the SQL execution directory this case /home/root Now the problem exactly, the output filename is now in the /home/root diretory as c:bobsoutput.txt and I can not do a thing with it. I need to get it off server or something but using a scp or cp or even mv t try rename keeps giving me this error [code] {root@proddb}# scp c:osaso_security_rules.txt gareth.thompson@prodtrans:/home/gareth.thompson/ ssh: c: Name or service not known {root@proddb}# [/code] Any suggestions or assist would be greatly appreciated thanks,:S
    Link to this post 28 May 10

    Hi Guys / Girls,

    Im in serious need of assistance here, and Im hoping there is a solution thats relatively easy from the command terminal not gui interface....

    I had a ^#$(^(#$^%&($ user generate a SQL script with a windows path and filename, and lovely SQL just converted it to one HUGE filename in the SQL execution directory this case /home/root

    Now the problem exactly, the output filename is now in the /home/root diretory as c:bobsoutput.txt and I can not do a thing with it. I need to get it off server or something but using a scp or cp or even mv t try rename keeps giving me this error


    {root@proddb}# scp c:osaso_security_rules.txt gareth.thompson@prodtrans:/home/gareth.thompson/
    ssh: c: Name or service not known
    {root@proddb}#

    Any suggestions or assist would be greatly appreciated thanks,:S

  • Digiza
    RE: RHEL 5
    Thanks mfillpot, Ill look at it and get back to you if need be, atleast now have a better Idea what I can do :) Thanks again.
    Link to this post 08 Apr 10

    Thanks mfillpot,

    Ill look at it and get back to you if need be, atleast now have a better Idea what I can do :)

    Thanks again.

  • Digiza
    RE: RHEL 5
    ah.......:blink: .........um....:S OK I know what your refering to as far as shell scripting goes. BUT:blink: I have Zero idea how to accomplish this.:blush: Im still exceptionally new to Linux, know how to do the basics, and have never worked with shell scripting, so not too sure how it works, how to pull info etc... Can you assist with a example please???? just on this basically. I would need the data displayed returned. ssh root@proddb1 bob123 [color=#008000]~password[/color] df -hl [color=#008000]~ Print out needed[/color] su - oracle sqlplus /"as sysdba" select count(*) from dba_objects where status='INVALID'; [color=#008000]~SQL Command that will need to return value[/color] And this would have tp repeat for proddb1-4 Sorry for being a pain in the behind. Hope you can assist
    Link to this post 07 Apr 10

    ah.......:blink: .........um....:S

    OK I know what your refering to as far as shell scripting goes. BUT:blink:

    I have Zero idea how to accomplish this.:blush: Im still exceptionally new to Linux, know how to do the basics, and have never worked with shell scripting, so not too sure how it works, how to pull info etc...

    Can you assist with a example please????

    just on this basically.
    I would need the data displayed returned.

    ssh root@proddb1
    bob123 ~password
    df -hl ~ Print out needed
    su - oracle
    sqlplus /"as sysdba"
    select count(*) from dba_objects where status='INVALID'; ~SQL Command that will need to return value

    And this would have tp repeat for proddb1-4

    Sorry for being a pain in the behind. Hope you can assist

Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board