Closed DocCyblade closed 9 years ago
I'd just mkdir
(and chown
) in your conf.d script...
Pretty sure I did that. But after I install on the ISO its not there? Maybe I am just being thick or over looking something. Take a look at the rewrite branch
Actually, looks like you do (I was looking on the wrong branch). That's weird!?
Is it possible that it is there but just not working how it should?
I just noticed the permissions you're setting. The execute bit works differently on directories than files so it should be 775. 664 will lock the odoo user (& group) out of the directory. Also, is there a reason why you give group permissions?
Stupid copy paste. I did not update it for the directory! Good catch
Does not root need write access as well?
@DocSyBlade. I can run a test in the AM if that works. Same branch you mentioned today?
@l-arnold - Yes, test dev-rc1
I am working on a re-write of init.d script but not there yet. Still need to test the pid re-location. This should fix the permission issue
This bug caused by implementing #44
Fixed applied, need to test that directory exists /var/run/odoo/
and the openerp-server.pid
is located in that directory.
Just ran today 10/10/15 (12:pm mtn). I do not see a Folder or File (nor does system) /var/run/odoo
Ok, will check on my end. Building now
Mystery solved. /var/run
is a tmpfs (temporary file system)
mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,relatime,size=10240k,nr_inodes=59355,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,relatime,size=98504k,mode=755)
/dev/sda1 on / type ext4 (rw,relatime,errors=remount-ro,data=ordered)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/lib/systemd/systemd-cgroups-agent,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls,net_prio)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=22,pgrp=1,timeout=300,minproto=5,maxproto=5,direct)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
mqueue on /dev/mqueue type mqueue (rw,relatime)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,relatime)
see line
tmpfs on /run type tmpfs (rw,nosuid,relatime,size=98504k,mode=755)
This is why this is not persistent. I'll modify the current code to create the file
Wild... on yhe temp drive..
Don't think you are calling but if using the Odoo "openerp-server start" call I think you do need to add -c. /(conf file location)
@DocCyblade Ah of course... That didn't occur to me...
So it sounds like either you'll want to let the service file (i.e. via start-stop daemon) handle the pid file; or put odoo's PID file somewhere in /opt/odoo; maybe /opt/odoo/run...
@l-arnold If you want Odoo to use cammandline options at start then they need to go inside the initscript (when it actually runs Odoo). At best the init system should just ignore any switches you append. At best it will throw an error...
@JedMeister - is putting a pid file in a location other than /var/run consistent with Debian packages? I am thinking we would let the service file check for the existence of the /var/run/odoo and create it. Thats what I am doing now in my experiment branch.
I did add that code to dev-rc1 so it should work. It still does not fix the issue with a restart I don't think. I am testing that out now.
current state of dev-rc1 seems to work even after first boot.
root@tkl-odoo ~# ls -l /var/run
...
drwxrwxr-x 2 openerp root 60 Oct 12 18:58 odoo
...
root@tkl-odoo ~# ls -l /var/run/odoo
-rw-r--r-- 1 openerp openerp 4 Oct 12 18:58 openerp-server.pid
root@tkl-odoo ~# systemctl stop openerp-server.service
root@tkl-odoo ~# systemctl status openerp-server.service
* openerp-server.service - LSB: Open Enterprise Resource Management software
Loaded: loaded (/etc/init.d/openerp-server)
Active: inactive (dead) since Mon 2015-10-12 19:35:14 UTC; 8s ago
Process: 4627 ExecStop=/etc/init.d/openerp-server stop (code=exited, status=0/SUCCESS)
Process: 3908 ExecStart=/etc/init.d/openerp-server start (code=exited, status=0/SUCCESS)
Oct 12 18:58:18 tkl-odoo systemd[1]: Starting LSB: Open Enterprise Resource Management software...
Oct 12 18:58:18 tkl-odoo openerp-server[3908]: Starting openerp-server: openerp-server.
Oct 12 18:58:18 tkl-odoo systemd[1]: Started LSB: Open Enterprise Resource Management software.
Oct 12 19:35:14 tkl-odoo systemd[1]: Stopping LSB: Open Enterprise Resource Management software...
Oct 12 19:35:14 tkl-odoo openerp-server[4627]: Stopping openerp-server: openerp-server.
Oct 12 19:35:14 tkl-odoo systemd[1]: Stopped LSB: Open Enterprise Resource Management software.
root@tkl-odoo ~# systemctl start openerp-server.service
root@tkl-odoo ~# systemctl status openerp-server.service
* openerp-server.service - LSB: Open Enterprise Resource Management software
Loaded: loaded (/etc/init.d/openerp-server)
Active: active (running) since Mon 2015-10-12 19:35:31 UTC; 1s ago
Process: 4627 ExecStop=/etc/init.d/openerp-server stop (code=exited, status=0/SUCCESS)
Process: 4661 ExecStart=/etc/init.d/openerp-server start (code=exited, status=0/SUCCESS)
CGroup: /system.slice/openerp-server.service
|-4665 python /opt/openerp/odoo/openerp-server --config=/etc/odoo/openerp-server.conf
|-4680 python /opt/openerp/odoo/openerp-server --config=/etc/odoo/openerp-server.conf
|-4681 python /opt/openerp/odoo/openerp-server --config=/etc/odoo/openerp-server.conf
|-4682 /usr/bin/python /opt/openerp/odoo/openerp-gevent --config=/etc/odoo/openerp-server.conf
|-4683 python /opt/openerp/odoo/openerp-server --config=/etc/odoo/openerp-server.conf
`-4684 python /opt/openerp/odoo/openerp-server --config=/etc/odoo/openerp-server.conf
Oct 12 19:35:31 tkl-odoo openerp-server[4661]: Starting openerp-server: openerp-server.
Oct 12 19:35:31 tkl-odoo systemd[1]: Started LSB: Open Enterprise Resource Management software.
root@tkl-odoo ~# tail /var/run/odoo/openerp-server.pid
4665
root@tkl-odoo ~# systemctl status openerp-server.service
* openerp-server.service - LSB: Open Enterprise Resource Management software
Loaded: loaded (/etc/init.d/openerp-server)
Active: active (running) since Mon 2015-10-12 19:35:31 UTC; 4min 5s ago
Process: 4627 ExecStop=/etc/init.d/openerp-server stop (code=exited, status=0/SUCCESS)
Process: 4661 ExecStart=/etc/init.d/openerp-server start (code=exited, status=0/SUCCESS)
CGroup: /system.slice/openerp-server.service
|-4665 python /opt/openerp/odoo/openerp-server --config=/etc/odoo/openerp-server.conf
|-4680 python /opt/openerp/odoo/openerp-server --config=/etc/odoo/openerp-server.conf
|-4681 python /opt/openerp/odoo/openerp-server --config=/etc/odoo/openerp-server.conf
|-4682 /usr/bin/python /opt/openerp/odoo/openerp-gevent --config=/etc/odoo/openerp-server.conf
|-4683 python /opt/openerp/odoo/openerp-server --config=/etc/odoo/openerp-server.conf
`-4684 python /opt/openerp/odoo/openerp-server --config=/etc/odoo/openerp-server.conf
Oct 12 19:35:31 tkl-odoo openerp-server[4661]: Starting openerp-server: openerp-server.
Oct 12 19:35:31 tkl-odoo systemd[1]: Started LSB: Open Enterprise Resource Management software.
root@tkl-odoo ~# ls -l /var/run/odoo/
total 4
-rw-r--r-- 1 openerp openerp 4 Oct 12 19:35 openerp-server.pid
root@tkl-odoo ~# systemctl stop openerp-server.service
root@tkl-odoo ~# ls -l /var/run/odoo/
total 0
root@tkl-odoo ~# systemctl status openerp-server.service
* openerp-server.service - LSB: Open Enterprise Resource Management software
Loaded: loaded (/etc/init.d/openerp-server)
Active: inactive (dead) since Mon 2015-10-12 19:46:27 UTC; 1min 8s ago
Process: 4859 ExecStop=/etc/init.d/openerp-server stop (code=exited, status=0/SUCCESS)
Process: 4661 ExecStart=/etc/init.d/openerp-server start (code=exited, status=0/SUCCESS)
Oct 12 19:35:31 tkl-odoo openerp-server[4661]: Starting openerp-server: openerp-server.
Oct 12 19:35:31 tkl-odoo systemd[1]: Started LSB: Open Enterprise Resource Management software.
Oct 12 19:46:27 tkl-odoo systemd[1]: Stopping LSB: Open Enterprise Resource Management software...
Oct 12 19:46:27 tkl-odoo openerp-server[4859]: Stopping openerp-server: openerp-server.
Oct 12 19:46:27 tkl-odoo systemd[1]: Stopped LSB: Open Enterprise Resource Management software.
root@tkl-odoo ~# service openerp-server start
root@tkl-odoo ~# tail /var/run/odoo/openerp-server.pid
4957
root@tkl-odoo ~# systemctl status openerp-server.service
* openerp-server.service - LSB: Open Enterprise Resource Management software
Loaded: loaded (/etc/init.d/openerp-server)
Active: active (running) since Mon 2015-10-12 19:47:52 UTC; 12s ago
Process: 4859 ExecStop=/etc/init.d/openerp-server stop (code=exited, status=0/SUCCESS)
Process: 4953 ExecStart=/etc/init.d/openerp-server start (code=exited, status=0/SUCCESS)
CGroup: /system.slice/openerp-server.service
|-4957 python /opt/openerp/odoo/openerp-server --config=/etc/odoo/openerp-server.conf
|-4972 python /opt/openerp/odoo/openerp-server --config=/etc/odoo/openerp-server.conf
|-4973 python /opt/openerp/odoo/openerp-server --config=/etc/odoo/openerp-server.conf
|-4974 /usr/bin/python /opt/openerp/odoo/openerp-gevent --config=/etc/odoo/openerp-server.conf
|-4975 python /opt/openerp/odoo/openerp-server --config=/etc/odoo/openerp-server.conf
`-4976 python /opt/openerp/odoo/openerp-server --config=/etc/odoo/openerp-server.conf
Oct 12 19:47:52 tkl-odoo openerp-server[4953]: Starting openerp-server: openerp-server.
Oct 12 19:47:52 tkl-odoo systemd[1]: Started LSB: Open Enterprise Resource Management software.
@DocCyblade Looks good.
Great question BTW. It prompted me to do some reading... For the record the PID location seems to be more of a convention (noted in the FHS) than a standard. From my reading the convention is to put PID files in /var/run
(or more recently /run
) or a sub-directory of it (as you've done here).
The next commonly accepted location seems to be a 'hidden' file within the odoo
user account home dir; e.g. /home/odoo/.openerp-server.pid
.
Finally there is also something of a "common practice" of replicating parts of the FHS within an /opt
install dir (e.g. /opt/odoo/etc
for conf; /opt/odoo/log
for logs; /opt/odoo/run
for pids). The point of this however is generally to make third party app installs self contained and seems to be most common for cross platform generic Linux installs (e.g. distributed as a tarball which can be simply untarred into /opt
.)
So armed with my new found knowledge I think you made the right call! :+1:
Also my reading made me realise the value of /var/run
being tmpfs. It's actually pretty cool. It is "self clearing" on reboot so a system crash or unclean shutdown won't leave stale pid files around...
Glad you learned something and then shared it!
I do like the idea of everything being under /opt but maybe another time.
Good food for thought!
As we are only installing in a single distro (essentially Debian) IMO it makes more sense to make the application integrate with the operating system conventions (i.e. use /etc
for settings, /var/log
for logs, /var/run
for pids, etc.) In my mind creating a more platform agnostic install would only make sense if you wanted to make a cross platform installer...
Agree with your logic, plus I don't have to do any thing else!
During build /var/run/odoo is not being created
I am thinking it's because maybe the CHROOT?
I may write in the init script to just create the directory on startup.