fix: restart after re-writing config file with SSL certificate

This commit is contained in:
Mahdi Dibaiee 2017-02-19 14:16:30 +03:30
parent cd44b525d1
commit 96d5eee027

View File

@ -33,16 +33,7 @@ module System.Serverman.Actions.Nginx (nginx) where
putStrLn $ "wrote your configuration file to " ++ path putStrLn $ "wrote your configuration file to " ++ path
restart <- async $ do wait =<< restart
let command = "systemctl restart nginx"
result <- tryIOError $ callCommand command
case result of
Left err -> do
putStrLn $ commandError command
Right _ ->
putStrLn $ "restarted " ++ show (service params)
wait restart
when (ssl params) $ do when (ssl params) $ do
case serverType params of case serverType params of
@ -56,6 +47,7 @@ module System.Serverman.Actions.Nginx (nginx) where
Right _ -> do Right _ -> do
putStrLn $ "created a certificate for " ++ domain params putStrLn $ "created a certificate for " ++ domain params
writeFile path (show params) writeFile path (show params)
wait =<< restart
wait letsencrypt wait letsencrypt
_ -> do _ -> do
@ -66,3 +58,13 @@ module System.Serverman.Actions.Nginx (nginx) where
putStrLn $ "for more information, see: https://certbot.eff.org/" putStrLn $ "for more information, see: https://certbot.eff.org/"
return () return ()
where
restart = async $ do
let command = "systemctl restart nginx"
result <- tryIOError $ callCommand command
case result of
Left err -> do
putStrLn $ commandError command
Right _ ->
putStrLn $ "restarted " ++ show (service params)