Server Scripts
Server scripts work just like Package Scripts, but they only apply to server-related interceptor points, and they go in your server.json. If you have several servers in a folder with their own server-name.json files, the server scripts can be different per server.
The interception points which will fire a server script are:
  • preServerStart
  • onServerStart
  • onServerInstall
  • onServerStop
  • preServerForget
  • postServerForget
Read more about when these interception points fire here.
Configure server scripts like so in your server.json:
1
{
2
"scripts":{
3
"onServerInstall":"cfpm list"
4
}
5
}
Copied!

Ad-hoc server scripts

Just like package scripts, you can also create ad-hoc scripts for a given server. They are executed with the server run-script command. Define them as additional keys in the scripts block.
1
{
2
"name" : "My Server"
3
"scripts":{
4
"myScript":"server log --follow"
5
}
6
}
Copied!
And run them like so:
1
server run-script myScript
Copied!
Copy link
Edit on GitHub