Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > alt.os.linux.ubuntu > #197451
| From | Bit Twister <BitTwister@mouse-potato.com> |
|---|---|
| Newsgroups | alt.os.linux.ubuntu |
| Subject | Re: systemd was Re: nautilus not working/wireless not responding either |
| Date | 2017-10-13 03:06 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <slrnou0bdp.m0n.BitTwister@wb.home.test> (permalink) |
| References | (4 earlier) <f44vb3F5i7kU1@mid.individual.net> <slrnotqlh7.4dn.BitTwister@wb.home.test> <f45hmkF99koU1@mid.individual.net> <slrnotr8ss.o4l.BitTwister@wb.home.test> <f4ab27Fd0riU1@mid.individual.net> |
On Thu, 12 Oct 2017 16:09:57 -0700, fred flintstone wrote: > On 10/10/2017 09:52 PM, Bit Twister wrote: >> On Tue, 10 Oct 2017 20:32:34 -0700, fred flintstone wrote: > > [Let's move on. Big snips.] > >> You might want to have a little compassion for the readers of your >> post and trim out/down un-need text. Yeah, I know, you might not know >> what is and is not needed but, for instance run these commands >> >> journalctl --since "1 minutes ago" >> journalctl --no-hostname --since "1 minutes ago" >> >> Notice any difference. >> >> Don't like all the typing, Here >> alias jctl='journalctl --no-hostname' >> jctl --since "2 minutes ago" >> jctl | tail -4 >> >> > > Again, thank for your detailed response, BT; I had never used the alias > feature before, but I suspect that you are shooting from the hip and > missed by a keystroke somewhere: Hehehehe, that is cute. When you make statements like that, you need to show us the command used and resulting output. I did not miss by a key stroke. I hit it dead center. I cut/passed from this reply. Watch me again very slowly. $ alias jctl='journalctl --no-hostname' $ jctl | grep fail | head -1 Oct 12 17:00:47 systemd[1]: privoxy.service: Unit entered failed state. Bash converted the alias "jctl" to journalctl --no-hostname ran it, sent output through grep, then call head to print the first line. > > $ cat 3.jctl.sh > #!/bin/bash > # if run by systemd: > #export PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin I can recommend adding line set -u # Show usage of unset variables as an error to help catch typos. > alias jctl='journalctl' > > jctl -S "10 m ago" >3.jctl.txt Recommendations: Use the long format for switch arguments in script, --since instead of -S. Use full noun instead of abbreviation, minutes instead of m. Makes it more readable, months from now if you have to work on. Even better, when you post the script/snippet it will make it much easier on anyone thinking about trying to help you. > jctl -S "10 m ago" >3.jctl.txt > echo 'last 4 in tail' >>3.jctl.txt > jctl | tail -4 >>3.jctl.txt Inefficient code. Same effect as follows: echo 'last 4 in tail' > 3.jctl.txt jctl -S "10 m ago" | tail -4 >> 3.jctl.txt You might consider having a coding standard. If you use a string more than once, put it in a variable. Example: TMP=$HOME/tmp _app=$(basename $0) _out_fn="$TMP/$(_app)_3.txt echo 'last 4 in tail' > $_out_fn jctl -S "10 m ago" | tail -4 >> $_out_fn Putting application name on start of file name with only one period in the name can help when you want to parse it for the suffix. Do not use leading numbers as file name where possible. I would have had jctl_3.sh as script name. With my suggested change you can run locate /jct which would return something like /bittwister/local/work/jctl_3.sh /bittwister/tmp/jctl_3.sh.txt Oh, yeah, forgot to mention. When I reply to someone, I keep in mind about lurkers in the thread and people who run across the reply in a search engine. All of what I post may already be known to you and may not apply so just ignore it. > exit > ... > $ sh 3.jctl.sh > ...runs without diagnostic... > $ cat 3.jctl.txt | tail -10 Congratulation, please collect your prize at http://porkmail.org/era/unix/award.html > Oct 12 08:53:37 bob-ThinkPad-SL510 NetworkManager[28084]: <info> > [1507823617.7494] dhcp6 (wlp5s0): state changed unknown -> expire Again, post just enough to make the point. > $ > > I use files that begin with ordinals and have a small toolbox that > clones that file and munges it slightly, so I can start with a clone and > test new syntax quickly: Sounds complex and runs the risk of screwing up code in the script. Personally, I work on the script in my work directory which is at the the front of $PATH. That way I run it and no other users will be impacted by my changes. > $ create.sh 3.jctl.sh > > This gives me a clone named 4.jctl.sh, and then I added a time stamp: > > $ cat 4.jctl.sh > #!/bin/bash > # if run by systemd: > #export PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin I can highly recommend always providing the path in the script. > alias jctl='journalctl --no-hostname' > now=$(date +"%T") > echo "Current time : $now" >4.jctl.txt > jctl -S "20 m ago" >>4.jctl.txt > echo 'last 4 in tail' >>4.jctl.txt > jctl | tail -4 >>4.jctl.txt > exit > ... > $ sh 4.jctl.sh > journalctl: unrecognized option '--no-hostname' > journalctl: unrecognized option '--no-hostname' Uh, huh, here is a solution for that. _jctl='journalctl --no-hostname' and fix $_jctl -S "20 m ago" >>4.jctl.txt $_jctl | tail -4 >>4.jctl.txt I like leading underscore for readability. Also helps seeing them in the environment. Example. env | grep _desktop= | sort -V -t '=' --key=2 _login desktop=1 _binaries desktop=2 _usenet desktop=3 _browsing desktop=4 _root desktop=5 _users desktop=6 _bank desktop=7 _mail desktop=8 > $ cat 4.jctl.txt > Current time : 09:10:56 > last 4 in tail > > Clearly, we're looking at a deluge of information and must winnow it out > along one of more criteria. Yep, thought that 10 minutes ago was abusive. Not to mention on a system that is really busy and has lmsensors installed. See -- Logs begin at Thu 2017-10-12 17:00:43 CDT $ journalctl --no-hostname -u sensord | wc -l 314 $ date Thu Oct 12 21:48:42 CDT 2017 Now that you are up to your ass in alligators you have forgotten why you were draining the swamp. You started out wanting code to run on network failure. If you back through the thread, I suggested a line of code to go into a dhclient-exit-hooks script and running man dhclient-script When the script runs, it would only have to go back a minute in my opinion, and tail would not be required. >>> Oct 10 20:11:05 dbus[822]: [system] Successfully activated >> ^ >> | >> name of program ----' issuing the message. > > Ok, there's always at least one field in these things that i don't > understand. So if I were at a terminal and I type kill 822 , then this > process would disappear? > Is 822 its unit ID number? Again, I do not know and have been running with the assumption that it is. > Oct 12 15:48:47 bob-ThinkPad-SL510 NetworkManager[28084]: <info> > [1507848527.8799] dhcp6 (wlp5s0): state changed expire -> done > > Likewise 28084 here for NetworkManager? Check it out for yourself. ps aux | grep NetworkManager
Back to alt.os.linux.ubuntu | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
nautilus not working/wireless not responding either fred flintstone <fred@server.invalid> - 2017-09-24 12:36 -0700
Re: nautilus not working/wireless not responding either "Jonathan N. Little" <lws4art@gmail.com> - 2017-09-24 15:46 -0400
Re: nautilus not working/wireless not responding either fred flintstone <fred@server.invalid> - 2017-09-29 14:26 -0700
Re: nautilus not working/wireless not responding either fred flintstone <fred@server.invalid> - 2017-10-04 19:40 -0700
Re: nautilus not working/wireless not responding either Bit Twister <BitTwister@mouse-potato.com> - 2017-10-05 05:03 +0000
Re: nautilus not working/wireless not responding either fred flintstone <fred@server.invalid> - 2017-10-07 15:49 -0700
Re: nautilus not working/wireless not responding either Bit Twister <BitTwister@mouse-potato.com> - 2017-10-07 23:24 +0000
Re: systemd was Re: nautilus not working/wireless not responding either Bit Twister <BitTwister@mouse-potato.com> - 2017-10-10 23:22 +0000
Re: systemd was Re: nautilus not working/wireless not responding either fred flintstone <fred@server.invalid> - 2017-10-10 20:32 -0700
Re: systemd was Re: nautilus not working/wireless not responding either Bit Twister <BitTwister@mouse-potato.com> - 2017-10-11 04:52 +0000
Re: systemd was Re: nautilus not working/wireless not responding either Melzzzzz <Melzzzzz@zzzzz.com> - 2017-10-11 05:00 +0000
Re: systemd was Re: nautilus not working/wireless not responding either fred flintstone <fred@server.invalid> - 2017-10-12 16:09 -0700
Re: systemd was Re: nautilus not working/wireless not responding either Bit Twister <BitTwister@mouse-potato.com> - 2017-10-13 03:06 +0000
Re: systemd was Re: nautilus not working/wireless not responding either "Jonathan N. Little" <lws4art@gmail.com> - 2017-10-13 00:33 -0400
Re: systemd was Re: nautilus not working/wireless not responding either Bit Twister <BitTwister@mouse-potato.com> - 2017-10-13 05:00 +0000
Re: systemd was Re: nautilus not working/wireless not responding either "Jonathan N. Little" <lws4art@gmail.com> - 2017-10-13 09:31 -0400
Re: systemd was Re: nautilus not working/wireless not responding either "Jonathan N. Little" <lws4art@gmail.com> - 2017-10-13 09:32 -0400
Re: systemd was Re: nautilus not working/wireless not responding either Bit Twister <BitTwister@mouse-potato.com> - 2017-10-13 14:19 +0000
Re: systemd was Re: nautilus not working/wireless not responding either Marek Novotny <marek.novotny@marspolar.com> - 2017-10-13 09:56 -0500
Re: systemd was Re: nautilus not working/wireless not responding either fred flintstone <fred@server.invalid> - 2017-10-22 14:35 -0700
Re: systemd was Re: nautilus not working/wireless not responding either Bit Twister <BitTwister@mouse-potato.com> - 2017-10-22 23:57 +0000
Re: systemd was Re: nautilus not working/wireless not responding either fred flintstone <fred@server.invalid> - 2017-10-25 12:03 -0700
Re: systemd was Re: nautilus not working/wireless not responding either "Jonathan N. Little" <lws4art@gmail.com> - 2017-10-26 12:46 -0400
Re: systemd was Re: nautilus not working/wireless not responding either Bit Twister <BitTwister@mouse-potato.com> - 2017-10-26 23:54 +0000
Re: systemd was Re: nautilus not working/wireless not responding either fred flintstone <fred@server.invalid> - 2017-10-31 17:28 -0700
Re: systemd was Re: nautilus not working/wireless not responding either Bit Twister <BitTwister@mouse-potato.com> - 2017-11-01 01:36 +0000
Re: systemd was Re: nautilus not working/wireless not responding either fred flintstone <fred@server.invalid> - 2017-11-06 12:35 -0800
[OT] Re: systemd was Re: nautilus not working/wireless not responding either Bit Twister <BitTwister@mouse-potato.com> - 2017-10-27 00:23 +0000
Re: systemd was Re: nautilus not working/wireless not responding either fred flintstone <fred@server.invalid> - 2017-10-25 16:13 -0700
Re: systemd was Re: nautilus not working/wireless not responding either "Jonathan N. Little" <lws4art@gmail.com> - 2017-10-13 11:42 -0400
Re: systemd was Re: nautilus not working/wireless not responding either "Jonathan N. Little" <lws4art@gmail.com> - 2017-10-13 11:45 -0400
Re: systemd was Re: nautilus not working/wireless not responding either fred flintstone <fred@server.invalid> - 2017-10-13 17:03 -0700
Re: systemd was Re: nautilus not working/wireless not responding either "Jonathan N. Little" <lws4art@gmail.com> - 2017-10-13 20:25 -0400
Re: systemd was Re: nautilus not working/wireless not responding either Bit Twister <BitTwister@mouse-potato.com> - 2017-10-14 01:45 +0000
Re: systemd was Re: nautilus not working/wireless not responding either Mike Easter <MikeE@ster.invalid> - 2017-10-10 16:34 -0700
Re: systemd was Re: nautilus not working/wireless not responding either Mike Easter <MikeE@ster.invalid> - 2017-10-10 16:41 -0700
Re: nautilus not working/wireless not responding either Mike Easter <MikeE@ster.invalid> - 2017-10-11 10:28 -0700
[OT] Re: nautilus not working/wireless not responding either Bit Twister <BitTwister@mouse-potato.com> - 2017-10-11 17:50 +0000
csiph-web