l4t3b0

Members
  • Posts

    7
  • Joined

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

l4t3b0's Achievements

Noob

Noob (1/14)

0

Reputation

  1. Dear @Squid I dont know too much about php, but i tried to debug your plugin. I have figured out, that the startScript.sh file already has the symtom that the HOME directory is not set. But with a 2 line modification i could fix the problem. I kindly ask you to examine my modification and if you agree, than please add it to your plugin, so others will have the fix too. With this modification my python plugin works too Actually i need only the export command and not the source. I thought that it could be useful for others in the future to try to initialize the environment as much close to the login shell as possible. What is your opinion?
  2. yes, i have tried the sudo version: sudo -i -u root /tmp/test.py It works! But i dont want to write a script to execute another one.
  3. In my case - when i use a python script that needs the home directory - the program is not raising an exception but does not find the config file in the home directory and therefore not initialized properly. Some more detail about home directory is not set correctly issue. If i install a script in the plugin that relies on the home directory than if it is executed from the crontab, then it works. So the "run script" and "run in background" buttons are malfunctioning in such cases.
  4. @JoeUnraidUser: Thanks for your reply. Actually the code i pasted here is not the script i want to execute. That one was only for demo purposes. Actually i'm trying to execute a python script. Neither bash nor python script works and none of them is aware of the home directory. Unfortunately i have to rely on a python 3rd party library, that is trying to use a config file in the home directory. I have the feeling that @mgutt is right and it has something to do with the php script or with the web server settings.
  5. Thanks for your reply Squid What is your opinion? Is it the expected behavior or should the PHP script be improved to somehow set the home variable before execution? My actual script would read config parameters from the ~ directory. Of course i could hard code explicit directory path, but i have the feeling that it shouldnt be like that.
  6. Hello everyone I would like to ask for your help to solve a problem i have when executing a script. I have difficulties to have to get the home directory of the user. Here is the script i have: #!/bin/bash echo "echo \$-: " $- echo -n "shopt login_shell: " shopt login_shell echo -n "whoami: " whoami echo "echo \$HOME: " $HOME echo "changing directory to ~" cd ~ echo -n "current working directory: " pwd grep root /etc/passwd When i run this script from the https://.../Settings/Userscripts i get the following output: Script location: /tmp/user.scripts/tmpScripts/test/script Note that closing this window will abort the execution of this script echo $-: hB shopt login_shell: login_shell off whoami: root echo $HOME: / changing directory to ~ current working directory: / root:x:0:0:Console and webGui login account:/root:/bin/bash So the ~ directory looks like equals to the / directory. If i copy the same content of the script to an a.sh and execute it from the shell, then i get the following output: echo $-: hB shopt login_shell: login_shell off whoami: root echo $HOME: /root changing directory to ~ current working directory: /root root:x:0:0:Console and webGui login account:/root:/bin/bash The HOME directory is the /root. Why don't i get the same result when i execute from the user script plugin? In both situation it is a non-interactive, non-login shell.