here is my node program
var fs = require('fs');
fs.writeFileSync('./data.txt', 'test');
it is in /home/test/ and the test directory 's privilege is rwxrwxrwx. when i run node test.js with the tomcat account, the data.txt could be created.
but when i run a service to execute su tomcat -c 'node /home/test/test.js', the data.txt could not be created and there is a permission denied hint in the stdout.
sudo service test
here is my service in /etc/init.d
su tomcat -c 'node /home/test/test.js'
can anyone tell me why
Aucun commentaire:
Enregistrer un commentaire