AbdelAziz ESSAADI
AbdelAziz ESSAADI

Reputation: 21

Group different linux command in one script

I have some checks that I do every 2 hours to monitor the status of servers like iostat -ch, df -h /DATA, free -mh, ps -aux | grep kafka and other commands and some shell scripts.

How can I group them in one or two scripts to execute them automatically without doing the same check manually every time?

Upvotes: 0

Views: 78

Answers (1)

paradx
paradx

Reputation: 74

So if I understand correctly you want to execute a bunch of commands as one script executed it automatically every two hours?

Start by writing a shell script:

#!/bin/sh

iostat -ch
df -h /DATA
free -mh
ps -aux | grep kafka

and then add it as a cron job (see cron)

Upvotes: 1

Related Questions