You are not logged in.

#1 2010-05-20 00:17:38

pogeymanz
Member
Registered: 2008-03-11
Posts: 1,020

My suspend script wont execute even though it's in $PATH

So I made a "script", if you can even call it that, at /usr/local/bin/suspend

#!/bin/bash
dbus-send --system --dest=org.freedesktop.Hal /org/freedesktop/Hal/devices/computer org.freedesktop.Hal.Device.SystemPowerManagement.Suspend int32:0

And my $PATH variable is:

[rob ~ ]$  echo $PATH
/bin:/usr/bin:/sbin:/usr/sbin:/usr/bin/perlbin/site:/usr/bin/perlbin/vendor:/usr/bin/perlbin/core:/usr/local/bin
[rob ~ ]$

And it is, of course, executable:

[rob ~ ]$  file /usr/local/bin/suspend
/usr/local/bin/suspend: Bourne-Again shell script text executable
[rob ~ ]$

If I type the full path into the terminal, it just doesn't do anything. I hit enter and nothing happens.

If I do run it by just typing 'suspend', the terminal waits for the action to complete and top says nothing interesting either:

[rob ~ ]$  suspend
^C^C^C^C^C

Can't even crash out of it. Just have to close the terminal.

Last edited by pogeymanz (2010-05-20 00:21:23)

Offline

#2 2010-05-20 00:20:12

yngwin
Member
Registered: 2009-05-08
Posts: 67

Re: My suspend script wont execute even though it's in $PATH

What are the permissions? Did you chmod +x it?

Offline

#3 2010-05-20 19:24:34

pogeymanz
Member
Registered: 2008-03-11
Posts: 1,020

Re: My suspend script wont execute even though it's in $PATH

[rob ~ ]$  ls -l /usr/local/bin/suspend
-rwxr-xr-x 1 root root 160 May 19 20:16 /usr/local/bin/suspend

Yep. I chowned it.

Offline

#4 2010-05-20 20:47:19

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: My suspend script wont execute even though it's in $PATH

suspend is a builtin

suspend [-f]   Suspend  the  execution  of this shell until it receives a SIGCONT signal.  A login shell cannot be suspended; the -f option can be used to override this and force the suspension.

Builtins take precedence:

If  the  command name contains no slashes, the shell attempts to locate it.  If there exists a shell function by that name, that function is invoked as described above in FUNCTIONS.  If the name does not match a function, the shell searches for it in the list of shell builtins.  If a match is found, that builtin is invoked.

If the name is neither a shell function nor a builtin, and contains no slashes, bash searches each element of the PATH for a directory containing an  executable  file  by that  name.

Offline

Board footer

Powered by FluxBB