Nginx "Bad Gateway" after restart

whenever I restart my server, the directory /tmp/seahub_cache will be created as follows:

drwx------ 2 root root 4096 Mär 3 09:00 seahub_cache

Therefore the seafile service cannot be startet:

root@lkb:/# /etc/init.d/seafile-server start
Traceback (most recent call last):
  File "/blackhole/seafile/server/seahub/", line 10, in <module>
  File "/blackhole/seafile/server/seahub/thirdpart/Django-1.8.17-py2.7.egg/django/core/management/", line 354, in execute_from_command_line
  File "/blackhole/seafile/server/seahub/thirdpart/Django-1.8.17-py2.7.egg/django/core/management/", line 328, in execute
  File "/blackhole/seafile/server/seahub/thirdpart/Django-1.8.17-py2.7.egg/django/", line 18, in setup
  File "/blackhole/seafile/server/seahub/thirdpart/Django-1.8.17-py2.7.egg/django/apps/", line 115, in populate
  File "/blackhole/seafile/server/seahub/seahub/base/", line 11, in ready
    cache.set('test_cache', 'worked')
  File "/blackhole/seafile/server/seahub/thirdpart/Django-1.8.17-py2.7.egg/django/core/cache/backends/", line 52, in set
    fd, tmp_path = tempfile.mkstemp(dir=self._dir)
  File "/usr/lib/python2.7/", line 314, in mkstemp
    return _mkstemp_inner(dir, prefix, suffix, flags)
  File "/usr/lib/python2.7/", line 244, in _mkstemp_inner
    fd =, flags, 0600)
OSError: [Errno 13] Permission denied: '/tmp/seahub_cache/tmp5l0fc_'

I need to delete the directory as stated in the manual (, then I can start the service and the directory is created like this:
drwx------ 2 seafile-service seafile-group 4096 Mär 3 09:05 seahub_cache

How can this be fixed?

ok, I found the problem: I added clearsessions to the crontab for execution at reboot. I think this is creating the directory with wrong permissions.
What is the best point to execute this? Is it necessary to run this when the server has rebooted?