1. Betriebssysteme >
  2. Linux Tipps >
  3. Best way to run a script after a device event?

ArabicEnglishFrenchGermanGreekItalianJapaneseKoreanPersianPolishPortugueseRussianSpanishTurkishVietnamese

Best way to run a script after a device event?


Linux Tipps vom | Direktlink: reddit.com Nachrichten Bewertung

Heya!

I found an old webcam with a button and I use this script to safely turn off my server when I press the said button:

#!/bin/bash exec >> /home/jan/kamera_gumb.log echo "[$(date -u)] Script started" device="/dev/input/event7" if [[ ! -c "$device" ]]; then echo "[$(date -u)] Device $device does not exist." echo "[$(date -u)] Terminating..." exit 1 fi key_down="*type 1 (EV_KEY)*value 1" key_up="*type 1 (EV_KEY)*value 0" sudo evtest "$device" | while read line; do case $line in # ($key_down) echo "[$(date -u)] Key down";; ($key_up) echo "[$(date -u)] Poweroff"; sudo poweroff;; # (*) echo echo "[$(date -u)] UNKNOWN -> $line";; esac done 

This is always running in the background tho... Is there a better way to poweroff my server without running this script in the background?

Also sometimes the "/dev/input/event7" doesn't exit so im also wondering if there is a better way to listen to this device events, is there maybe a label I could use like it is used to map drives?

submitted by /u/GotYaNoob
[link] [comments]...

Externe Webseite mit kompletten Inhalt öffnen



https://www.reddit.com/r/linux/comments/hj8kbj/best_way_to_run_a_script_after_a_device_event/

Team Security Social Media

➤ Weitere Beiträge von Team Security | IT Sicherheit

  • P4wnP1 A.L.O.A. - Framework Which Turns A Rapsberry Pi Zero W Into A Flexible, Low-Cost Platform For Pentesting, Red Teaming And Physical Engagements

    vom 289.92 Punkte ic_school_black_18dp
    P4wnP1 A.L.O.A. by MaMe82 is a framework which turns a Rapsberry Pi Zero W into a flexible, low-cost platform for pentesting, red teaming and physical engagements ... or into "A Little Offensive Appliance".0. How to installThe latest image could be fo
  • Best Apple iPhone iOS Apps List: (April 2020)

    vom 193.32 Punkte ic_school_black_18dp
    Best Apple iPhone iOS Apps List (2020) There are thousands of iOS apps available on the app store to choose from - so many, in fact, choosing the right and time-saving productivity apps/ tools have changed the way we communicate, watch TV and play games. or i
  • TA18-106A: Russian State-Sponsored Cyber Actors Targeting Network Infrastructure Devices

    vom 160.32 Punkte ic_school_black_18dp
    Original release date: April 16, 2018Systems Affected Generic Routing Encapsulation (GRE) Enabled DevicesCisco Smart Install (SMI) Enabled DevicesSimple Network Management Protocol (SNMP) Enabled Network DevicesOverview This joint Technical Alert (TA) is the result of analy
  • MileIQ and Azure Event Hubs: Billions of miles streamed

    vom 152.8 Punkte ic_school_black_18dp
    This post was co-authored by Shubha Vijayasarathy, Program Manager, Azure Messaging (Event Hubs) With billions of miles logged, MileIQ provides stress-free logging and accurate mileage reports for millions of drivers. Logging and reporting miles driven
  • DetectionLab - Vagrant And Packer Scripts To Build A Lab Environment Complete With Security Tooling And Logging Best Practices

    vom 149.34 Punkte ic_school_black_18dp
    DetectionLab is tested weekly on Saturdays via a scheduled CircleCI workflow to ensure that builds are passing.PurposeThis lab has been designed with defenders in mind. Its primary purpose is to allow the user to quickly build a Windows domain that comes pre-loa
  • Kube-Bench - Checks Whether Kubernetes Is Deployed According To Security Best Practices As Defined In The CIS Kubernetes Benchmark

    vom 146.02 Punkte ic_school_black_18dp
    kube-bench is a Go application that checks whether Kubernetes is deployed securely by running the checks documented in the CIS Kubernetes Benchmark.Tests are configured with YAML files, making this tool easy to update as test specifications evolve.Please Not
  • IoT Plug and Play is now available in preview

    vom 131.84 Punkte ic_school_black_18dp
    Today we are announcing that IoT Plug and Play is now available in preview! At Microsoft Build in May 2019, we announced IoT Plug and Play and described how it will work seamlessly with IoT Central. We demonstrated how IoT Plug and Play simplifies d
  • 10 Best Torrent Search Engines List- 2020 (100% Working Torrent Search Engine)

    vom 127.92 Punkte ic_school_black_18dp
    10 Best Torrent Search Engines List- 2020 (100% Working Torrent Search Engine) Torrent Search EnginesBefore going to find what are the best torrent search engines, first, you need to know actually what is a torrent and how it works?To download any movie, games, or any d
  • Android Studio 2.0

    vom 127.35 Punkte ic_school_black_18dp
    Posted by Jamal Eason, Product Manager, Android Android Studio 2.0 is the fastest way to build high quality, performant apps for the Android platform, including phones and tablets, Android Auto, Android Wear, and Android TV. As the official IDE from Google, Android Studio includes everything you need to
  • Android Studio 2.0

    vom 127.35 Punkte ic_school_black_18dp
    Posted by Jamal Eason, Product Manager, Android Android Studio 2.0 is the fastest way to build high quality, performant apps for the Android platform, including phones and tablets, Android Auto, Android Wear, and Android TV. As the official IDE from Google, Android Studio includes everything you need to
  • Announcing self-serve experience for Azure Event Hubs Clusters

    vom 125.29 Punkte ic_school_black_18dp
    For businesses today, data is indispensable. Innovative ideas in manufacturing, health care, transportation, and financial industries are often the result of capturing and correlating data from multiple sources. Now more than ever, the ability to re
  • What’s New in Android: Q Beta 3 & More

    vom 125.07 Punkte ic_school_black_18dp
    Posted by Dave Burke, VP, Engineering Today Android is celebrating two amazing milestones. It’s Android’s version 10! And today, Android is running on more than 2.5B active Android devices. With Android Q, we’ve focused on three themes: innovation, security and privacy, and digital wellbeing. We want to he

Team Security Diskussion über Best way to run a script after a device event?