salmon.utils module¶
Mostly utility functions Salmon uses internally that don’t really belong anywhere else in the modules. This module is kind of a dumping ground, so if you find something that can be improved feel free to work up a patch.
- salmon.utils.check_for_pid(pid, force)[source]¶
Checks if a pid file is there, and if it is sys.exit. If force given then it will remove the file and not exit if it’s there.
- salmon.utils.daemonize(pid, chdir, chroot, umask, files_preserve=None, do_open=True)[source]¶
Uses python-daemonize to do all the junk needed to make a server a server. It supports all the features daemonize has, except that chroot probably won’t work at all without some serious configuration on the system.
- salmon.utils.drop_priv(uid, gid)[source]¶
Changes the uid/gid to the two given, you should give utils.daemonize 0,0 for the uid,gid so that it becomes root, which will allow you to then do this.
- salmon.utils.import_settings(boot_also, boot_module='config.boot')[source]¶
Returns the current settings module, there is no harm in calling it multiple times
The location of the settings module can be control via
SALMON_SETTINGS_MODULE