I would suggest to create a systemctl service. Please find below the procedure (root permission required):
1. Create a service file
$ vi /etc/systemd/system/testrpc.service
2. Add the content
[Unit]
Description = Start testrpc
After = network.target
[Service]
ExecStart = /usr/lib/node_modules/ethereumjs-testrpc/bin/testrpc
[Install]
WantedBy = multi-user.target
You might have to change the path of the testrpc executable
3. Reload the daemon services and enable testrpc service
$ systemctl daemon-reload
$ systemctl enable testrpc
That's done
Usage
Start the service
systemctl start testrpc
Stop the service
systemctl stop testrpc
Restart the service
systemctl restart testrpc
Check the status of the service
systemctl status testrpc
● testrpc.service - Start testrpc
Loaded: loaded (/etc/systemd/system/testrpc.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2017-10-15 11:23:38 UTC; 2s ago
Main PID: 29880 (node)
Tasks: 6
Memory: 817.8M
CPU: 1.826s
CGroup: /system.slice/testrpc.service
└─29880 node /usr/lib/node_modules/ethereumjs-testrpc/bin/testrpc
Oct 15 11:23:40 instance-1 testrpc[29880]: (5) 59eeef2c9e108c23f24b385d841b8615f14362f1e1c8b413c5caf563c48f70bb
Oct 15 11:23:40 instance-1 testrpc[29880]: (6) 529d71f653a52a26d24263f9967308207a5b6e59111797c0fe423f1909926165
Oct 15 11:23:40 instance-1 testrpc[29880]: (7) f52acfc25e53a52bf493909f58b222dda288c06a01e6922fdc7e38dabb0b7487
Oct 15 11:23:40 instance-1 testrpc[29880]: (8) 6cdebc1efe3d82f30e6242a595cf80eec813252fc25710151e08c1c7b9e26609
Oct 15 11:23:40 instance-1 testrpc[29880]: (9) 4da9f0d0af082f7ad649f082136f0244774d597b34b8d3b492951decb23a8335
Oct 15 11:23:40 instance-1 testrpc[29880]: HD Wallet
Oct 15 11:23:40 instance-1 testrpc[29880]: ==================
Oct 15 11:23:40 instance-1 testrpc[29880]: Mnemonic: obscure enact cushion throw rabbit flame chest suggest stick library dice three
Oct 15 11:23:40 instance-1 testrpc[29880]: Base HD Path: m/44'/60'/0'/0/{account_index}
Oct 15 11:23:40 instance-1 testrpc[29880]: Listening on localhost:8545
View testrpc's output
sudo journalctl -u testrpc
If you are curious, more info about Linux systemd here.