Need some kind advices on webhooks

To be honest, at this moment i didn’t succeed. My frontend is maintained by pm2, so I’m trying to ask Strapi to trigger this command “pm2 restart frontend”, still nothing happens. My code looks like this:

module.exports = {
	lifecycles: {
	    async afterUpdate(result, params, data) {
	    	const { exec } = require("child_process");
	    	exec("pm2 restart frontend", (error, stdout, stderr) => {

	    	});
	    },
   },
};

Should it be something like this, or I’m getting it wrong?