Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9230339
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:48:05+00:00 2026-06-18T05:48:05+00:00

I am trying to write a small bash script to monitor the output of

  • 0

I am trying to write a small bash script to monitor the output of RiotShield (a 3rd party player scraper for League of Legends) for crashes. If a keyword is found in the log it should kill the process and restart it.

Here is my bash script as is:

#!/bin/bash
crash[1]="disconnected"
crash[2]="38290209"
while true; do
    list=$(tail log.log)
    #clear
    echo "Reading Log"
    echo "========================================"
    echo $list
    for item in ${list//\\n/ }
    do
            for index in 1 2
            do
                    c=${crash[index]}
                    #echo "Crash Word:" $c
                    if [[ "$c" == *"$item"* ]]; then
                            echo "RiotShield has crashed."
                            echo "Killing RiotShield."
                            kill $(ps aux | grep '[R]iotShield.exe' | awk '{print $2}')
                            echo "RiotShield killed!"
                            echo "Clearing log."
                            echo > log.log
                            echo "Starting RiotShield"
                            (mono RiotShield.exe >> log.log &)

                    fi
            done

    done

    sleep 10
done

My crash array are keywords that I know show in the log when it crashes. I have 38290209 in there only for testing purposes as it is my summoner ID on League of Legends and the moment I preform a search for my Summoner name the ID shows in the log.

The problem is even when disconnected and 38290209 do not show up in the log my

if [[ "$c" == *"$item"* ]]; then

fires, kills the RiotShield process and then relaunches it.

The length of the crash array will grow as I find more keywords for crashes so I cant just do

if [[ "$c" == "*disconnected*" ]]; then

Please and thanks SOF

EDIT:

Adding working code:

#!/bin/bash
crash[1]="disconnected"
crash[2]="error"
while true; do
    list=$(tail log.log)
    clear
    echo "Reading Log"
    echo "========================================"
    echo $list
    for index in 1 2
    do
            c=${crash[index]}
            #echo "Crash Word:" $c
            if [[ $list == *$c* ]]; then
                    echo "RiotShield has crashed."
                    echo "Crash Flag: " $c
                    echo "Killing RiotShield."
                    kill $(ps aux | grep '[R]iotShield.exe' | awk '{print $2}')
                    echo "RiotShield killed!"
                    echo "Clearing log."
                    echo > log.log
                    echo "Starting RiotShield"
                    (mono RiotShield.exe >> log.log &)
                    fi
            done
    sleep 10
done
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T05:48:07+00:00Added an answer on June 18, 2026 at 5:48 am

    I think you have the operands in your expression the wrong way around. It should be:

    if [[ $item == *$c* ]]; then
    

    because you want to see if a keyword ($c) is present in the line ($item).

    Also, I’m not sure why you need to break the line into items by doing this: ${list//\\n/ }. You can just match the whole line.

    Also note that double-quotes are not required within [[.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to write a small media player using GTK+ and GStreamer and
I am trying to write a small ruby script that will have two methods
I am trying to write a small pl/sql script and need some help. first,
I am trying to write a small AppleScript that can output a string of
I'm trying to write a small script to set all users images to their
I'm trying to write a small batch script that will delete files old files
I am trying to write a small PHP script for managing subscriptions for a
I am trying to write a small python script to rename a bunch of
I'm trying to write a small ruby script that detects if a given argument
I'm trying to write a small script which parses and executes Brainfuck code, to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.