Jump to content

Button Script


PixL

Recommended Posts

9 hours ago, PixL said:

I would like to create a script to start a command on pressing the button but then to stop the command when pressing the button again... any ideas?

Create a file in /tmp on the first press. If it exists, stop whatever you want, and remove the file.

That should work :)

Link to comment
Share on other sites

Like this?

#!/bin/bash

while [ ! -f /tmp/beacon ]
do
  killall mdk3
  led reset
  rm -rf /tmp/beacon

else
do
touch /tmp/beacon
mdk3 wlan1mon b -w -n Test
led YELLOW on

done

 

Edited by PixL
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...