func (s *initSystemSuite) TestInstallCommandsLogfile(c *gc.C) { name := "jujud-machine-0" s.conf.Logfile = "/var/log/juju/machine-0.log" service := s.newService(c) commands, err := service.InstallCommands() c.Assert(err, jc.ErrorIsNil) test := systemdtesting.WriteConfTest{ Service: name, DataDir: s.dataDir, Expected: strings.Replace( s.newConfStr(name), "ExecStart=/var/lib/juju/bin/jujud machine-0", "ExecStart=/var/lib/juju/init/jujud-machine-0/exec-start.sh", -1), Script: ` # Set up logging. touch '/var/log/juju/machine-0.log' chown syslog:syslog '/var/log/juju/machine-0.log' chmod 0600 '/var/log/juju/machine-0.log' exec >> '/var/log/juju/machine-0.log' exec 2>&1 # Run the script. `[1:] + jujud + " machine-0", } test.CheckCommands(c, commands) }
func (s *initSystemSuite) TestInstallCommandsShutdown(c *gc.C) { name := "juju-shutdown-job" conf, err := service.ShutdownAfterConf("cloud-final") c.Assert(err, jc.ErrorIsNil) svc, err := systemd.NewService(name, conf, s.dataDir) c.Assert(err, jc.ErrorIsNil) commands, err := svc.InstallCommands() c.Assert(err, jc.ErrorIsNil) test := systemdtesting.WriteConfTest{ Service: name, DataDir: s.dataDir, Expected: ` [Unit] Description=juju shutdown job After=syslog.target After=network.target After=systemd-user-sessions.service After=cloud-final [Service] ExecStart=/sbin/shutdown -h now ExecStopPost=/bin/systemctl disable juju-shutdown-job.service [Install] WantedBy=multi-user.target `[1:], } test.CheckCommands(c, commands) }
func (s *initSystemSuite) TestInstallCommands(c *gc.C) { name := "jujud-machine-0" commands, err := s.service.InstallCommands() c.Assert(err, jc.ErrorIsNil) test := systemdtesting.WriteConfTest{ Service: name, DataDir: s.dataDir, Expected: s.newConfStr(name), } test.CheckCommands(c, commands) }