I am new to Linux. I recently ported my C++ window service to linux daemon.
In windows, I have the below folder structure. I found the structure is easy to allow other colleagues to follow and upgrade to new version.
C:\services\my_app\version_1_0\my_app.exe
C:\services\my_app\version_1_0\my_app.config.xml
C:\services\my_app\version_1_0\dependencies1.dll
C:\services\my_app\version_1_0\log\my_app_20121110.log
C:\services\my_app\version_1_0\data\my_app_data_20121110.txt
C:\services\my_app\start_my_app.bat
I have researched a bit on where to deploy in Linux and found quite confusing:
- Some people say the binary should be deployed in /usr/bin/my_app
- The log folder should be /var/log/my_app
- Where should I place the data file?
- The start up script should be placed in /etc/init.d/my_app
Thanks for your help in advance.
You might find this Wikipedia article helpful, it explains the purpose of the various folders in a typical linux file system.
Points 1, 2 and 4 are correct: your daemon should be in
/usr/bin, writing logs to/var/logand the start-up script should be in/etc/init.d.As for the “data” file, it depends on what it actually contains. If it’s something that your application uses for configuration, it should go to
/etc/yourapp. Otherwise it belongs in/usr/share/yourapp.