1

This Bash script is called from a SlackBot using a Python script that uses the paramiko library. This works perfectly when I run the script locally from the bot. It runs the application and then kills the process after the allotted time. But when I run this same script on a server from the SlackBot, it doesn't kill the process. Any suggestions?? The script name is "runslack.sh" which is what is called with the grep command below.

#!/bin/bash

slack-export-viewer -z "file.zip"

sleep 10

ps aux | grep runslack.sh | awk '{print $2}' | xargs kill
Jason Jabbour
  • 47
  • 2
  • 9

1 Answers1

0

Please try this and let me know if this helps you

ps -ef | grep runslack.sh | grep -v grep  | awk '{print $2}' |xargs -i kill -9 {}

and i hope your user has sufficient permission to execute/kill this action on your server environment.

Sid
  • 57
  • 1
  • 6