I have a problem regarding permissions in a CentOS server.
I created a NetCore application that reads some values from dmidecode. When I deployed the application in my CentOS server, I runned the following command:
chmod 777 ApplicationName
Then, I execute it, and eveything works fine.
My problem is when I try to set that application in crond, for that I do:
1) service crond stop 2) crontab -e 3) * * * * * cd /ApplicationFolder && ./ApplicationName 4) service crond start
My application is executed, but I can't get the dmidecode values I am trying to read, I am assuming that I am having a permission problem, because it works fine when executing as a console application.
I tried to set a user in the crond line by doing:
* * * * * root cd /ApplicationFolder && ./ApplicationName
But nothing happens, the application isn't even started...
Does anyone knows what I am doing wrong?
As proposed by the comments, I changed the crontab to:
* * * * * /ApplicationFolder/ApplicationName
But the same is happening...
The reason why I think I am having a problem related with permissions its because if I run the program as an application values are logged into a text file, while when I execute the application using crond the same info is logged but the values are empty.
I also read that when reading Serial Numbers from dmidecode we would need root privileges, but my current account using crontab is already the root account.
cdbut use absolute path to the program. In that case
/ApplicationFolder/ApplicationName. Does your application writes those values to file or to stdout?