maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   General (https://talk.maemo.org/forumdisplay.php?f=7)
-   -   Gnuite applet with run command (https://talk.maemo.org/showthread.php?t=2699)

pc4ever1 2006-08-05 23:06

Gnuite applet with run command
 
I have been trying to run commands from the Gnuite's load/run applet(see link below) . However they don't appear to be executing. I know the executable script files work because when I run them form Xterm command line they work.

I have been using the following to execute the command from the applet's run command:

./go2drv

or

sh ./go2drv

Neither one of these commands work within the applet but do work at the Xterm command line

I have a few questions.
*********************
Can someone suggest a method to make them execute "go2drv" from this applet.

Is there a way to have the applet open Xterm and then execute the "go2drv" file?

Thanks for the help!

http://gnuite.com:8080/nokia770/

BanditRider 2006-08-06 01:36

Put the file in /usr/bin

pc4ever1 2006-08-06 03:06

I must be dense.
I put the files into /usr/bin and still get no results when using the load/run app.
When I open xTerm and issue the same commands that I used in the load/run app it works.

Does the Load/Run app "run" command line actually issue a command to xTerm, if not where does it send it to?

By the way I have tried to uninstall and re-install the Load/Run app and that didn't work either.

BanditRider 2006-08-06 10:11

Put the file in /usr/bin and don't use ./ or sh

Just use the filename

pc4ever1 2006-08-06 13:47

I tried all of that ( nothing in front of the script name, then tried ./ and then sh ) and it still doesn't run.

Does the Load/Run app "run" command line actually issue a command to xTerm, if not where does it send it to?

Thanks for the suggestions

BanditRider 2006-08-06 14:46

It sends it to the shell - sh
can you run the command by just typing it's name?

pc4ever1 2006-08-06 15:34

Quote:

can you run the command by just typing it's name?
I'm assuming you mean running from within xTerm. If so then Yes, works great.

But when using the same command via run/load applet nothing happens, however after running the command the run/load command states "command completed with exit code 1".

BanditRider 2006-08-07 11:46

Show me the contents of your script.

pc4ever1 2006-08-07 12:35

Here's the script:
****************
#!/bin/sh
user=user
if grep $user /etc/passwd
then password=rootme
sudo su -
cd /home/user/MyDocs/.documents
./foto1.sh
fi

The script for foto1.sh is:
**************************
grep -q cifs /home/user/MyDocs/.documents || insmod ./cifs.ko
mount -t cifs //192.168.001.112/Photos /home/user/MyDocs/.documents/foto -o domain=MSHOME,user=guest,password=guest


Both scripts function from the xTerm prompt, but do nothing running from the Run/Load applet.

Thanks for checking this out.

BanditRider 2006-08-07 15:54

OK, Here's what I'd do:
as root,
move the cifs.ko file to /lib/modules
add the following line to /etc/init.d/minircS near the top after the PATH= line:

insmod /lib/modules/cifs.ko

add the folowing line to the bottom of /etc/fstab

//192.168.001.112/Photos /home/user/MyDocs/.documents/foto cifs rw,domain=MSHOME,user=guest,password=guest
0 0

(all on one line)

Now your single script should be:

#!/bin/sh
# mount cifs shared folder
# use gainroot to become root and relaunch itself
if [ `id -u` != 0 ] ; then
#if not already root, call itself as root
sudo gainroot <<EOF
$0 $*
EOF
exit
fi
mount /home/user/MyDocs/.documents/foto

Put this script in /usr/bin, reboot and you're good to go.
Call it whatever you like, no need for ./ or a .sh extension. just make it executable.

pc4ever1 2006-08-07 16:24

BanditRider Thanks for the tips, I truley appreciate the time you have spent on this! I'll give this a try when I get off work and report back as to it's results.

gnuite 2006-08-08 02:30

Also, if you haven't already, try using an absolute pathname. I don't think sh uses /etc/profile (and the load-plugin is basically using sh), so it might not be setting a PATH. I know I've had trouble trying to get it to recognize my ~/bin/ directory.

And make sure you (not just root) have execute permissions on the file.

Also, the "sudo su -" part might be screwing you up - that will start a new (interactive) shell, which will not get any input since the load-applet is running it.

I personally would add your command to the /etc/sudoers file and use sudo to run the command, instead of using "sudo su -".

pc4ever1 2006-08-08 05:43

BanditRider, I tried your suggestions and it didn't work. Tried some other things and still no good.

Gnuite, I'm a noob so when you say "try using an absolute pathname" I'm not sure what this means

As for permissions I set chmod 755 on the command and then chmod +x , won't this work?

I also added the command to /etc/sudoers and this didn't work.

Any other suggestions?
Thanks

BanditRider 2006-08-08 11:11

What error are you getting now?

pc4ever1 2006-08-08 16:08

BanditRider: Without having the 770 in front of me, I recall when using your last suggestions verbatim that the script didn't work via Load/Run. I then tried it within xTerm and it ran to a point where it prompted me for a password. I typed in rootme and this didn't work , so I tried with some other passwords and nothing seemed to work.

Thanks again for checking this out.

CrapBot 2006-08-08 17:53

Absolute path means type in the full path. So if your script is in your home folder, type /home/user/script.sh or whatever it's called.

I've noticed that anything that gets run from the menu system, Desktop links etc, need to have the full path.

Gav

BanditRider 2006-08-08 18:10

I don't get prompted for a password because I've disabled root login as part of installing Openssh.

passwd -l root

that's -ell

This prevents someone logging in as root over ssh (a good thing). But still allows you to use sudo gainroot or sudo su -

pc4ever1 2006-08-09 15:10

BanditRider: Thanks again for the help. I'm still at it, and haven't found a solution...yet, but I'll keep trying.

As for the password -l root
When issue that command I would expect that I wouldn't be able to connect to the 770 via putty/ssh. But the thing that keeps bothering me is I still can SSH into the 770 using user and rootme. Am I doing something wrong here when setting the password?

BanditRider 2006-08-09 19:52

I ssh into the 770 as user.
I have setup the keys in /home/user/.ssh (authorized_keys2 and known_hosts)
This allows me to login as user with no password needed.
Then to do root stuff I just sudo su -
and I'm root with no password needed.
For security reasons, you don't want to ssh in as root.
Set your user password to something secure. (not rootme or password or god ...)


All times are GMT. The time now is 01:10.

vBulletin® Version 3.8.8