LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Suddenly it wont work anymore... (https://www.linuxquestions.org/questions/linux-newbie-8/suddenly-it-wont-work-anymore-877536/)

brownie_cookie 04-28-2011 01:39 AM

Suddenly it wont work anymore...
 
Hi all

Yesterday i made a script with funtions, everything worked until 15 minutes ago, and i can't figure out what did go wrong.
I think it has to do something with the 3 first rules of code... but for my opinion that should be fine (i used '777' just to be sure)
Code:

test_mount() {
        $touch /current_mount
        $chmod 777 /current_mount
        $mount | $grep -v none > /current_mount

        VAR=`$diff -s /default_mount /current_mount`
        echo $VAR var

        if  [ "$VAR" = "Files /default_mount and /current_mount are identical" ]; then
                # OK
        value6=0
        else
                # CRITICAL
        value6=2
        fi
       
        $rm -f /current_mount
}

so if i run it, i get the critical message... but i shouldn't !!
why do i use all those variables? because they are defined at the beginning of the script, so i have only one place to change them if needed.
i think the rest is clear? probably there is a better way to check mounts, but this is just a quick solution (which isn't working anymore xD :doh:)
so if anyone has a suggestion or something else, i'll be happy to hear it from you

Kind regards

brownie_cookie 04-28-2011 01:57 AM

appearently he doesn't make the file...
he has to do that on a remote server

this is the pre-defined touch command
Code:

touch="/bin/touch"
monitor server:
Code:

# which touch
/bin/touch

remote server:
Code:

# which touch
/bin/touch

so that's not the problem...
i just don't understand why he doesn't make that file

can someone help me pls?!


Kind regards

brownie_cookie 04-28-2011 02:02 AM

okay guys, update...

he WON'T make a file in the root (/) but he will make it in (let's say) /tmp ...
so in other words

/current_mount -> NO
/tmp/current_mount -> YES

then i thought let's do a
Code:

chmod 777 /
but still it's a no-go...

can someone PLS explain why?

jschiwal 04-28-2011 02:49 AM

You are polluting the root (/) directory with files. Also / is only writable by root, so you can't write files there as a normal user.

You could extract the mount points from /etc/fstab. The currently mounted directories are also available from /etc/mtab and /proc/mounts/.

brownie_cookie 04-28-2011 02:55 AM

Quote:

Originally Posted by jschiwal (Post 4338971)
You are polluting the root (/) directory with files. Also / is only writable by root, so you can't write files there as a normal user.

You could extract the mount points from /etc/fstab. The currently mounted directories are also available from /etc/mtab and /proc/mounts/.

it is a testing server, so it doesn't matter...
it's just the shortest way, anyways...

I'm executing everything as root, so...

but i'll see what /etc/fstab, /etc/mtab and /proc/mounts give me
-> which file do you prefer, i mean which is the most accurate?


All times are GMT -5. The time now is 11:54 PM.