Debian Programming :: BASH Script For Battery Alert (Low)
May 19, 2010
I'm trying to make my own BASH script for alerting low battery. It's working well, but it simply show messages, whether the state is 'Discharging' or 'Charging'.
Here is the code:
Code: Select all#!/bin/bash
#checking sleep time
SLEEP_TIME="60"
#actions
ACTION="xfce4-terminal -x sudo shutdown -h now"
[Code] ....
View 6 Replies
ADVERTISEMENT
Nov 26, 2010
I have a little problem about string in Snort alerting. I understood about Snort alerting saved in /var/log/snort/alert and Snort will add a new entry if there was a attack from anywhere. Then here's my problem. Because it has a lot of file on it, all I want to do is parse that string in snort alert then make into simply log files with it. I'm getting confused with Snort alert and parse that file.
Here's the simple algorithm; Snort get the alert <- parse the alert with my parameter which I've configured with bash (ip address, dest, kind of attack and time) <- then sent that parse alert into new text (let's called snortsent.txt) <- after ten alerts then clear the text then waiting again until the Snort alert go on -> back to snort alert. Here's the sample of my snort alert: (/var/log/snort/alert)
[Code]....
View 16 Replies
View Related
Aug 23, 2013
Code handy which could play a beep/alert sound when somebody (any user) joins your LAN. Or as second-hand choice, if this is too hard, to play a beep when X terminal windows writes some output lines.
View 2 Replies
View Related
Mar 2, 2010
getting back to our laptop, the stability window is ~3.2V. Meaning that when you operate the battery above this the electrolyte is oxidized on the positive electrode and reduced on the negative electrode. Remember that we only want to oxidize and reduce the active materials and don't want to do anything else. All these reactions other than the ones we want are called side reactions and these are really bad for the battery. The nominal voltage of a laptop battery is 3.7 V which means that something bad wants to happen as we use the battery.So long story short, stuff (e.g., passive layers and poor kinetics of reactions) happens and things are not as bad as they seem and you can increase the voltage up to 4.2V without bad things really happening. All chargers for Li-ion cells today cut the battery off when it reaches 4.2V. What you have to realize is that at 4.2V, these side reactions are present in finite amounts and start to chemically kill the battery, but its not that dramatic.
Operating to 4.1V makes things better and extends the life, 4.0 V is even better and so on. So why don't battery manufacturers cut the voltage off at, say, 4 V to get better battery life? Because every time you cut this voltage down you decrease the capacity of the battery and its run time. The 4.2V cutoff is a compromise between good run time and decent (read "not pathetic) life.On the other hand, if you charge the battery and then pull the plug (so to speak), the battery discharges some, the voltage drops, and these reactions become less of a problem and your battery life goes up. So the best things you can do is to charge the laptop (or cell phone, camera etc.) and once its charged, pull the plug. Your battery will thank you for it.As a matter of fact, if you own a Lenovo Thinkpad, you can actually change the state of charge to which you charge the battery using the Battery Maintenance utility. You can change this from charging to 100% state (where the voltage is 4.2V) to 90% so that your voltage is less. You lose some energy is doing that, but atleast you can change it to 100% when you need battery power and put it back down to 90% when you can plug in. I wish my Mac has the same feature.
I typically use the battery for a while (say 1/2 hour to 1 hour), then plug it in and wait to fully charge it, then I pull the plug and use it again for 1/2 hour to 1h and then I repeat this. Takes some getting used to and I forget to do this, but I try.
View 1 Replies
View Related
Aug 25, 2015
You are probably using systemd (check it with ps --pid 1) and therefore /etc/init.d isn't considered for autostart. Here can you find some information about systemd and autostart [1]. As far as I know systemd isn't intended to start applications with systemd. I recommend you to use the autostart feature of your window manager or desktop environment or at least the .xinitrc.
[URL] ....
View 7 Replies
View Related
Jul 22, 2014
I am trying to replicate what is happening on this page under the tcsh shell, but using the bash shell found in Wheezy. Here is the page I am referring to:[URL] The command I am trying to replicate is on page 6 under figure 2.4. The command is "prompt> ./mem &; ./mem &".
I would like to run the same program twice, concurrently, but do not know how. Note that I am not trying to use a bash script, but rather by simply using syntax on the command line.
View 4 Replies
View Related
Jun 22, 2011
I have used "FILENAME="`TZ=$TZ+24 date +%y%m%d`" in a bash script that run in openbsd. What my script does is to changes a file name to "yesterdays date". I tried to use it in a script that runs in debian but it doesnt work. Is there any other command that i can use in debian?
View 3 Replies
View Related
Jan 17, 2014
I am writing a script that calls a program which writes a lot of lines to stdout continuosly. If the last line in stdout has some regex, THEN, certain variables are updated. My problem is that I don't know how to do that.
A simplified example would be (it's not my exact case, but it I write it here to clarify): suppose I issue a ping command (which writes output to stdout continuously). Every time that the response time is t=0.025 ms, THEN, VARIABLE1=(column1 of that line) and VARIABLE2=(column2 of that line).
I think the following code would work in awk (however, I want the variables in bash and I don't know how to export them)
Code: Select allping localhost |awk '{ if ( $8 == "time=0.025" ) var1=$1 var2=$2}'
In the previous code, awk analyzes each line of the output of the ping command as soon as it is created, so the variables $var1, $var2, ... are updated at the appropriate time. But I need the "real-time" updated values of $var1, $var2 in bash, for later use in the script.
View 7 Replies
View Related
Sep 15, 2014
Whats the bash script for like, how synaptic package manager runs ..
When you run synaptic it ask for root password ..
How do I do this in bash script?
View 5 Replies
View Related
Dec 14, 2014
I'm trying to start Chrome in kiosk mode from a systemd service on boot. The 'webserver app' named 'xx' in the samples launches but chromium never comes up.
xx.service :
Code: Select all[Unit]
Description=xx Service
After=syslog.target
[Service]
Environment="DISPLAY=:0.0"
Type=forking
WorkingDirectory=/usr/bin/xx/
ExecStart=/usr/bin/xx/xx
ExecStartPost=/usr/local/xx/chromium.sh
Restart=on-abort
[Install]
WantedBy=multi-user.target
chromium.sh
Code: Select allchromium-browser --kiosk http://xx-01.local:8081 &
View 1 Replies
View Related
Feb 16, 2011
I am running a Java application on the command line bash terminal under Mint Debian. I have JDK1.6.0_22 installed 64-bit, and the OS is 64-bit too. I have a few JAR files in the directory and a few native LWJGL libraries. When I run the application using the command line, all works fine.
Lets assume my directory where the files are is called /home/riz/MyGame. I change to that directory and this is the command I use code...
View 3 Replies
View Related
Jul 11, 2011
I am trying to check what all processes are accessing a particular file (a UDP socket in my case) on a filesystem.I am using 'fuser' for that.But, it seems, it only gives the processes accessing the file at that particular moment.Is there any way to continuously run 'fuser' (or some other command) which will give all processes accessing the file during its run?OR is it possible to generate a filesystem alert when a particular process accesses the file?
View 1 Replies
View Related
Feb 4, 2011
I would like to know how do I print the line # in a script. My requirement is, I have a script which is about ~5000 lines long. If there are any errors happen I just exit. And I would like to add the line # of the script where the error happened.
View 3 Replies
View Related
Jan 24, 2010
simple bash code:
Code:
#!/bin/bash
trap "echo 'you got me'" SIGINT SIGTERM # to trap ctrl+c
echo "Press ctrl+c during 5 sec loop"
for ((i=0;i<5;i++)); do
[Code]...
How come code behaves normally and stops when ctrl+c signal is caught and resumes, but after I use at least one timeout read in the code it looks like, if signal is caught again it doesn't pause the execution but skips the loop. If you remove -t (timeout) option from the read, both loops look the same!
View 10 Replies
View Related
Nov 26, 2008
I have a config file that contains:
my.config:
Code:
Now in my bash script, I want to get the output /home/user instead of $HOME once read. So far, I have managed to get the $HOME variable but I can't get it to echo the variable. All I get is the output $HOME.
Here is my parse_cmd script:
Code:
View 3 Replies
View Related
Jul 25, 2011
I have written quite a few separate bash & scripts and php scripts that up to now I have run from cron jobs. However I have to estimate how long each takes to run, before running the next and so it probably takes much longer than necessary to run them all. They have to run in order.
Now there are so many I am thinking it would be better to have a master bash script that would run one after the other, but I am not sure how to get the master script to wait before starting to run the next script. Is this possible and is there a command that will make the script wait between bash and php scripts , for them to finish, before running the next?
View 5 Replies
View Related
Jan 9, 2010
I would like to get the filename (without extension) and the extension separately. The best solution I found so far is:
Let FILE="thefilenameofsomefilesfor_instance.txt"
Code:
NAME=`echo "$FILE" | cut -d'.' -f1`
EXTENSION=`echo "$FILE" | cut -d'.' -f2`
I think it would be better to count the len and remove 3 chars to right to get the extension, but it can be macintosh filenames with have 4 chars for extensions.
View 5 Replies
View Related
May 1, 2010
Just installed 9.10 followed by a 10.04 upgrade (wouldn't work as a 10.04 clean install). The install and upgrade all seemed to go well.
But now when booting I get a message saying "checking battery state" and then it boots no further. This is a laptop without a battery installed, running permanently from the mains through the charger.
How can I disable this check so that the laptop will still boot without a battery fitted?
View 5 Replies
View Related
Jun 22, 2011
I've recently installed Squeeze on my laptop. All was fine (except for a small change I needed to make to the GRUB code in order to install and boot it) and I find the OS easy to use. I am sure I will be using it for a long time! I might even change my desktop over to Squeeze as well - I'm using Linux Mint 10 at the moment.I have found just one minor problem: the battery icon continuously shows 100% full, even when the indicator on the laptop is showing that it needs recharging - after about two hours' use.This has not happened before:although the laptop is about two years' old, I have had this battery for only a month, so it has not yet done much work!
View 4 Replies
View Related
Jun 26, 2015
In Jessie I would change the "critically low battery value". So from dconf-editor I followed this path:
Code: Select all/org/gnome/settings-daemon/plugins/power/
as suggested here [URL] ....
and here [URL] ....
The problem is that I haven't none of the following fields:
time-action
time-critical
time-low
or
use-time-for-policy
percentage-action
percentage-critical
percentage-low
How can I overcome this problem? Why the dconf-editor seems to be incomplete?
View 2 Replies
View Related
Feb 24, 2011
How to set battery charge thresh ?I use thinkpad w500 with Debian 6 .
View 1 Replies
View Related
Jul 13, 2011
I have looked all over the place but I can't find if this is possible. I am running Debian 6 as a media server (SMB) and it is tied to a UPS, I used gnome power management to set up a low battery shutdown but this UPS also is powering another embedded computer. So, I was wondering if it was possible to have a script run (to log in and shut down the embedded system) before gnome power management shuts down the Debian server. I know I could probably get it to run on every shutdown, but I am looking for low power only.
View 1 Replies
View Related
Jul 1, 2011
is there a way to configure shutdown on critically low battery to give me a bit of time before actually shutting down?I've set Gnome to shutdown on low battery. Problem is, I don't get any notification about battery running low, and as soon as battery level reaches the critical threshold, the system starts shutdown without me having any possibility to quickly complete some tasks. Of course, I'd increase battery level thresholds accordingly.
View 3 Replies
View Related
Apr 21, 2013
I have Evoluent Vertical Mouse connected via USB. It would work fine connected to my laptop on AC power, but it would freeze when on battery.I have "laptop-mode-tools" installed, and I traced this problem to laptop-mode-tools trying to put the mouse to sleep and not waking it up.To solve this, I have blacklisted the power management for the USB mouse. First, I did "lsusb" to find the mouse device:
Bus 002 Device 003: ID 1a7c:0068 Evoluent VerticalMouse 3..And got the ID of the device. Then I edited the laptop mode configuration and added this id to the blacklist:
/etc/laptop-mode/conf.d/usb-autosuspend.conf
edit this line:
AUTOSUSPEND_USBID_BLACKLIST="1a7c:0068"
View 1 Replies
View Related
Feb 17, 2011
When I am working with Windows OS on the DELL-Vostro-1014 laptop the battery is working. If however I switch to Debian Squeeze OS the battery does not work. Running #hardinfo & shows that there is no battery. Am I right in assuming that the driver for the battery?
/sys/class/power_supply/BAT0 gives
model_name DELL X612G0
Serial No. 18069
manufacturer LG
What driver is needed, where to search for it and how to incorporate in the kernel 2.26.32-5-686 ?
View 2 Replies
View Related
Apr 6, 2011
The display becomes less bright when on battery than on AC power, but I already unchecked "Reduce backlight brightness" on the power management setting. What else can affect the brightness?
View 5 Replies
View Related
Sep 9, 2011
when running on AC-power, only on battery.When I have my laptop on battery, and I plug the mouse in, then the USB mouse is working if I keep moving it around. If I then lay it alone for 5 secs, or so. it stops working.I cannot get USB sticks to work as well.
View 3 Replies
View Related
Mar 31, 2011
I need to rename the resulted searched files from a loopI have the following code:
find . -name DOC* | while read i
do
find $i -type f -name '*.txt'
done
basically, I am searching for all txt files inside any folder starting with DOC name.this code is working fine with me.I need to rename those .txt files to .txtOLDOS: Ubuntu 10.4Bash shell
View 10 Replies
View Related
Aug 31, 2010
I have a 3 year old laptop with the original battery and its drained pretty bad. The "Battery may be broken" popup was driving me insane and this is how you disable it, in case you are in the same situation as me. Open terminal
Code:
gconf-editor
Drill down to...
apps --> gnome-power-manager --> notify
uncheck the low_capacity checkbox. This should disable the popup for you if your battery has little life left in it. Now, if any knows how to disable the Avahi popup, let me know.
View 3 Replies
View Related
Apr 7, 2016
After a successful install of the MFC-J4420DW printer and scanner using Brother's install utility, I am experience severe battery drain and xsane freezes (total system lockup, requiring using CONFIG_MAGIC_SYSRQ keyboard command REISUB or hard reset).
The Brother support page and utility/drivers are found here: URl....My laptop is the HP Elitebook 8540W and I am running Debian 8 using LVM, separate partitions for /home, /var, /temp, /swap, and /. I have looked at logs in /var/log. kern.log, daemon.log, messages and dmesg, but have not found any relevant info ...
I purged all drivers/packages and tried a manual install using each deb package, but ran into some permission errors, so I purged again. I also purged xsane and reinstalled it, then did a complete printer reinstall using the brother Driver Install Tool.The tool works great, full functionality for the MFC-J4420DW. But I know I can't live with the power drain, and I would really prefer to use Gimp and the xsane plugin rather than simple scan ..
View 3 Replies
View Related