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


Groups > linux.debian.user > #236053 > unrolled thread

Is invoking the -locker option of xautolock to run a script known? Could I be helped with an xautolock code line please?

Started by"Susmita/Rajib" <bkpsusmitaa@gmail.com>
First post2021-06-13 14:00 +0200
Last post2021-06-13 15:20 +0200
Articles 7 — 3 participants

Back to article view | Back to linux.debian.user


Contents

  Is invoking the -locker option of xautolock to run a script known?  Could I be helped with an xautolock code line please? "Susmita/Rajib" <bkpsusmitaa@gmail.com> - 2021-06-13 14:00 +0200
    Re: Is invoking the -locker option of xautolock to run a script  known? Could I be helped with an xautolock code line please? "Susmita/Rajib" <bkpsusmitaa@gmail.com> - 2021-06-13 15:00 +0200
      Re: Is invoking the -locker option of xautolock to run a script  known? Could I be helped with an xautolock code line please? Greg Wooledge <greg@wooledge.org> - 2021-06-13 15:20 +0200
        Re: Is invoking the -locker option of xautolock to run a script known?  Could I be helped with an xautolock code line please? The Wanderer <wanderer@fastmail.fm> - 2021-06-13 15:40 +0200
          Re: Is invoking the -locker option of xautolock to run a script  known? Could I be helped with an xautolock code line please? Greg Wooledge <greg@wooledge.org> - 2021-06-13 16:40 +0200
      Re: Is invoking the -locker option of xautolock to run a script  known? Could I be helped with an xautolock code line please? "Susmita/Rajib" <bkpsusmitaa@gmail.com> - 2021-06-13 16:40 +0200
    Re: Is invoking the -locker option of xautolock to run a script  known? Could I be helped with an xautolock code line please? Greg Wooledge <greg@wooledge.org> - 2021-06-13 15:20 +0200

#236053 — Is invoking the -locker option of xautolock to run a script known? Could I be helped with an xautolock code line please?

From"Susmita/Rajib" <bkpsusmitaa@gmail.com>
Date2021-06-13 14:00 +0200
SubjectIs invoking the -locker option of xautolock to run a script known? Could I be helped with an xautolock code line please?
Message-ID<CpwWu-3tg-1@gated-at.bofh.it>
Namaste, my illustrious Team Leaders and Senior programming wizards,

Hope that the 2nd wave of Covid has not been able to dampen our
enthusiasm, and that all are safe from the virus and well. But the
loss of life and employment of many of my fellow countrymen saddens me
a great deal.

I have one minor other issue because of Covid Lockdown that is
inadvertently delayed (unrelated to this post):  getting my HCL Me
laptop serviced to clean the accumulated dust that blocks the fan and
switches off the laptop within a short time.
But this minor issue can wait as many lives could be saved by lockdown
and social distancing.

As I have said earlier too, my non-Unix non-Console background and
poor coding abilities restrict me from reading the man page.

Could I be helped with this requirement please?

My post rests for two months at the Debian Forums without any input,
here: http://forums.debian.net/viewtopic.php?f=8&t=149128#p736179

As said earlier too, the modified code works beautifully:
--------------------------------------------------------------------------
#!/bin/bash
echo "Usage: run the script ./ssvr.sh"
i=0
while true
do
expr $(( i = i + 1 ))
read -p "To stop press n and Enter : " -t 2 INPOOT
xset dpms force off
# kill -STOP $(pidof $1)
 sleep 2
# xset dpms force off
# kill -CONT $(pidof $1)
# sleep 2
if [ "$INPOOT" = "n" ]; then
echo "Ending..."
echo i
exit 0
fi
done
--------------------------------------------------------------------------

Hashed up the kill -STOP and -CONT parts are unnecessarily getting me
logged out of my system.

Now with the hashed up lines, the script works even better.

Best,

Rajib Bandopadhyay
Etc.

[toc] | [next] | [standalone]


#236054 — Re: Is invoking the -locker option of xautolock to run a script known? Could I be helped with an xautolock code line please?

From"Susmita/Rajib" <bkpsusmitaa@gmail.com>
Date2021-06-13 15:00 +0200
SubjectRe: Is invoking the -locker option of xautolock to run a script known? Could I be helped with an xautolock code line please?
Message-ID<CpxSx-414-3@gated-at.bofh.it>
In reply to#236053
Corrigendum:
-------------------
May the line, "... Hashed up the kill -STOP and -CONT parts are
unnecessarily getting me
logged out of my system ..."
be please read as:
"... Hashed up the kill -STOP and -CONT parts, as these are
unnecessarily getting me
logged out of my system ..."

I could invoke this line and have my objective fulfilled:
xautolock -time 1 -locker "xset dpms force off"

But I need to run the script file with xautolock.

Best wishes.
RKB

[toc] | [prev] | [next] | [standalone]


#236057 — Re: Is invoking the -locker option of xautolock to run a script known? Could I be helped with an xautolock code line please?

FromGreg Wooledge <greg@wooledge.org>
Date2021-06-13 15:20 +0200
SubjectRe: Is invoking the -locker option of xautolock to run a script known? Could I be helped with an xautolock code line please?
Message-ID<CpybT-4mz-7@gated-at.bofh.it>
In reply to#236054
On Sun, Jun 13, 2021 at 06:10:23PM +0530, Susmita/Rajib wrote:
> But I need to run the script file with xautolock.

So, let me see if I understand you.  You rambled so much that it's
really not clear what you're asking.  But if I'm reading this
sentence right, you have a shell script that requires a terminal
to work, because you prompt the user for input and then read input
from the terminal.

And now you would like to run this script as a child of xautolock,
which I'm guessing is a pure X11 client program, and does not run
inside a terminal.

Well, that's just a non-starter.  Throw the shell script away, and
write a new program that doesn't require a terminal to do its work.
This could be achieved in shell by using some tool that interacts
with the user without a terminal -- say, zenity or something.  Or, you
could abandon the shell entrely, and write a Tcl/Tk application instead.

[toc] | [prev] | [next] | [standalone]


#236059

FromThe Wanderer <wanderer@fastmail.fm>
Date2021-06-13 15:40 +0200
Message-ID<Cpyvg-4sQ-11@gated-at.bofh.it>
In reply to#236057

[Multipart message — attachments visible in raw view] — view raw

On 2021-06-13 at 09:14, Greg Wooledge wrote:

> On Sun, Jun 13, 2021 at 06:10:23PM +0530, Susmita/Rajib wrote:
> 
>> But I need to run the script file with xautolock.
> 
> So, let me see if I understand you.  You rambled so much that it's 
> really not clear what you're asking.  But if I'm reading this 
> sentence right, you have a shell script that requires a terminal to
> work, because you prompt the user for input and then read input from
> the terminal.
> 
> And now you would like to run this script as a child of xautolock, 
> which I'm guessing is a pure X11 client program, and does not run 
> inside a terminal.
> 
> Well, that's just a non-starter.  Throw the shell script away, and 
> write a new program that doesn't require a terminal to do its work.

If I'm parsing your rephrasing of the problem statement correctly,
couldn't this be addressed by having the script spawn an xterm or
similar and run the needed command(s) - perhaps in the form of another
script - within that?

I have a script which launches an xterm, echos a prompt, and then runs a
command which takes input and uses that input to launch another script.
It's been working fine for more than a year.

In my case the problem could probably be addressed more elegantly by
having my script invoke something like gksudo, since the command which
takes input in my case is 'su - -c "programname and arguments"', but the
design approach seems like it would generalize well to cases which
invoke other commands instead.

-- 
   The Wanderer

The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all
progress depends on the unreasonable man.         -- George Bernard Shaw

[toc] | [prev] | [next] | [standalone]


#236061 — Re: Is invoking the -locker option of xautolock to run a script known? Could I be helped with an xautolock code line please?

FromGreg Wooledge <greg@wooledge.org>
Date2021-06-13 16:40 +0200
SubjectRe: Is invoking the -locker option of xautolock to run a script known? Could I be helped with an xautolock code line please?
Message-ID<Cpzrj-51v-5@gated-at.bofh.it>
In reply to#236059
On Sun, Jun 13, 2021 at 09:39:24AM -0400, The Wanderer wrote:
> If I'm parsing your rephrasing of the problem statement correctly,
> couldn't this be addressed by having the script spawn an xterm or
> similar and run the needed command(s) - perhaps in the form of another
> script - within that?

Yes, that's another way to do it.

[toc] | [prev] | [next] | [standalone]


#236060 — Re: Is invoking the -locker option of xautolock to run a script known? Could I be helped with an xautolock code line please?

From"Susmita/Rajib" <bkpsusmitaa@gmail.com>
Date2021-06-13 16:40 +0200
SubjectRe: Is invoking the -locker option of xautolock to run a script known? Could I be helped with an xautolock code line please?
Message-ID<Cpzrj-51v-7@gated-at.bofh.it>
In reply to#236054
Solved.
Not very complicated, it appears.
The line is: xautolock -time 1 -locker "./ssvr.sh"
Thank you for your support.
Best.
RKB
Etc.

[toc] | [prev] | [next] | [standalone]


#236056 — Re: Is invoking the -locker option of xautolock to run a script known? Could I be helped with an xautolock code line please?

FromGreg Wooledge <greg@wooledge.org>
Date2021-06-13 15:20 +0200
SubjectRe: Is invoking the -locker option of xautolock to run a script known? Could I be helped with an xautolock code line please?
Message-ID<CpybU-4mz-19@gated-at.bofh.it>
In reply to#236053
On Sun, Jun 13, 2021 at 05:05:55PM +0530, Susmita/Rajib wrote:
> #!/bin/bash
> expr $(( i = i + 1 ))

Try one of these alternatives:

i=$((i + 1))      # This one also works in sh.
((i = i + 1))     # These two are bashisms.
((i++))

> echo "Ending..."
> echo i

Pretty sure you intended this to be echo "$i".

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.user


csiph-web