Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > alt.os.linux.ubuntu > #197531

Re: systemd was Re: nautilus not working/wireless not responding either

From fred flintstone <fred@server.invalid>
Newsgroups alt.os.linux.ubuntu
Subject Re: systemd was Re: nautilus not working/wireless not responding either
Date 2017-10-25 12:03 -0700
Message-ID <f5c5g4F8u30U1@mid.individual.net> (permalink)
References (12 earlier) <orqf9g$34g$2@dont-email.me> <slrnou1is6.jir.BitTwister@wb.home.test> <6dednQH9XdaBSX3EnZ2dnUU7-W2dnZ2d@giganews.com> <f54h99Ffor4U1@mid.individual.net> <slrnouqc3d.jcr.BitTwister@wb.home.test>

Show all headers | View raw


On 10/22/2017 04:57 PM, Bit Twister wrote:
> On Sun, 22 Oct 2017 14:35:35 -0700, fred flintstone wrote:
> 
>> I'd like still to get this script to run any time the wireless fails,
> 
> Do yourself a favor, install this quick, untested, kludge and bounce
> your network and see what is in the output file.
> ----8<----8<----8<----8<--cut below this line--8<----8<----8<
> 
> #!/bin/bash
> #******************************************************
> #* dump_env - Dump dhclient-exit-hooks environment vars
> #*
> #* Install:  locate the dhclient-exit-hooks.d directory,
> #*           save script in the .d/ directory and set execute perms
> #* Example:
> #*           locate dhclient-exit-hooks.d/
> #*           cp dump_env /etc/dhclient-exit-hooks.d/
> #*           chmod +x /etc/dhclient-exit-hooks.d/dump_env
> #*
> #******************************************************
> export PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin
> 
> _app=$(basename $0)
> _out_fn=/var/tmp/$_app.log
> 
> env | sort >> $_out_fn
> echo "Current time : $now" >> $_out_fn
> journalctl --since "1 minute ago"  >> $_out_fn
> 
> #***********************end dump_env*******************************
> 

Thanks, BT, I've had some time now to get the envelope data and array it 
usefully as per above, but my system has a few differences. Let's look 
at the code. I named your code 1.env.sh and then used my create tool to 
clone it, saving it as 2.env.sh, incrementing the output if it has any, 
and pulling it up in gedit for modification.

sudo cp 2.env.sh /etc/dhcp/dhclient-exit-hooks.d/

My scripts begin with a number followed by a period. Ben Bararisse 
suggested it in comp.unix.programmer, but it's entirely possible that he 
could have pranking me. I find that it saves on typing on the command 
line to use lower numbers first, a tab key, and a period.

In the new script, I define a path where I want the output:

_app=$(basename $0)
_path_to=/home/bob/Desktop/perl/logs/dhooks/
_out_fn=$_path_to$_app.log

echo "basename dollar sign zero is" $_app
echo "path is" $_path_to

env | sort >> $_out_fn
echo "Current time : $now" >> $_out_fn
journalctl --since "1 minute ago"  >> $_out_fn


cd /etc/dhcp/dhclient-exit-hooks.d/

Does this archictecture change between our two systems? Mine seems to 
have an intermediary dhcp directory.

$ chmod +x 2.env.sh
chmod: changing permissions of '2.env.sh': Operation not permitted

If I had typed

sudo -i

before this, would this have been permitted?

$ sudo chmod +x 2.env.sh
$ ls -l
total 16
-rwxr-xr-x 1 root root    0 Oct 24 17:48 1.env.sh
-rwxr-xr-x 1 root root  891 Oct 25 10:59 2.env.sh
lrwxrwxrwx 1 root root    8 May 25 05:37 debug -> ../debug
-rw-r--r-- 1 root root 1756 Apr 13  2016 rfc3442-classless-routes
-rw-r--r-- 1 root root 1117 Jan 12  2017 timesyncd
-rwxr-xr-x 1 root root 1025 Nov 24  2015 zzz_avahi-autoipd
$ 2.env.sh
2.env.sh: command not found

Question: why do I chmod +x this script?

$ sh 2.env.sh
basename dollar sign zero is 2.env.sh
path is /home/bob/Desktop/perl/logs/dhooks/
$ diff --help | less
$ pwd
/etc/dhcp/dhclient-exit-hooks.d
$
$ pwd
/home/bob/Desktop/perl/logs/dhooks
$ ls -l
total 8
-rw-rw-r-- 1 bob bob 3437 Oct 25 10:49 1.env.bob.log
-rw-rw-r-- 1 bob bob 3871 Oct 25 11:03 2.env.sh.log

This first listing is this a renamed file from the envelope output when 
run in its native location.
$ diff 1.env.bob.log 2.env.sh.log
28c28
< OLDPWD=/home/bob/Desktop/perl/logs
---
 > OLDPWD=/home/bob/Desktop/perl
34c34
< PWD=/home/bob/Desktop/perl
---
 > PWD=/etc/dhcp/dhclient-exit-hooks.d
50c50
< WINDOWID=65017434
---
 > WINDOWID=65011722
67c67,70
< -- No entries --
---
 > -- Logs begin at Wed 2017-10-18 14:02:36 PDT, end at Wed 2017-10-25 
11:02:05 PDT. --
 > Oct 25 11:02:05 bob-ThinkPad-SL510 sudo[4290]:      bob : TTY=pts/1 ; 
PWD=/etc/dhcp/dhclient-exit-hooks.d ; USER=root ; COMMAND=/bin/chmod +x 
2.env.sh
 > Oct 25 11:02:05 bob-ThinkPad-SL510 sudo[4290]: 
pam_unix(sudo:session): session opened for user root by (uid=0)
 > Oct 25 11:02:05 bob-ThinkPad-SL510 sudo[4290]: 
pam_unix(sudo:session): session closed for user root
$

Is there something in particular I should grep for?
-- 
fred

Back to alt.os.linux.ubuntu | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


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