I have a node.js script which need to start at boot and run under the www-data user. During development I always started the script with:
su www-dat
Well you can do it but may catch more exceptions.
So if the your script should runs as another user such as www U should make sure the PATH and other environment is ok.
sudo -u www -i /the/path/of/your/script
Please prefer the sudo manual~ -i [command] The -i (simulate initial login) option runs the shell specified by the password database entry of the target user as a loginshell...