nixos/redis: move 'redis_init.service' into the preStart hook of 'redis.service'
This commit is contained in:
parent
5a81797119
commit
28dee92fff
|
@ -224,26 +224,17 @@ in
|
||||||
|
|
||||||
environment.systemPackages = [ cfg.package ];
|
environment.systemPackages = [ cfg.package ];
|
||||||
|
|
||||||
systemd.services.redis_init =
|
|
||||||
{ description = "Redis Server Initialisation";
|
|
||||||
|
|
||||||
wantedBy = [ "redis.service" ];
|
|
||||||
before = [ "redis.service" ];
|
|
||||||
|
|
||||||
serviceConfig.Type = "oneshot";
|
|
||||||
|
|
||||||
script = ''
|
|
||||||
install -d -m0700 -o ${cfg.user} ${cfg.dbpath}
|
|
||||||
chown -R ${cfg.user} ${cfg.dbpath}
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
systemd.services.redis =
|
systemd.services.redis =
|
||||||
{ description = "Redis Server";
|
{ description = "Redis Server";
|
||||||
|
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
after = [ "network.target" ];
|
after = [ "network.target" ];
|
||||||
|
|
||||||
|
preStart = ''
|
||||||
|
install -d -m0700 -o ${cfg.user} ${cfg.dbpath}
|
||||||
|
chown -R ${cfg.user} ${cfg.dbpath}
|
||||||
|
'';
|
||||||
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
ExecStart = "${cfg.package}/bin/redis-server ${redisConfig}";
|
ExecStart = "${cfg.package}/bin/redis-server ${redisConfig}";
|
||||||
User = cfg.user;
|
User = cfg.user;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user