Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Mon 15 Oct 2018, 17:40
All times are UTC - 4
 Forum index » House Training » Users ( For the regulars )
How to stop this infinite loop?
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [13 Posts]  
Author Message
scientist

Joined: 23 May 2015
Posts: 864

PostPosted: Sat 15 Aug 2015, 18:25    Post subject:  How to stop this infinite loop?  

I know that Ctrl Z can stop this.

Is there a way to make this infinite loop unstoppable other that a reboot ?

Code:
while :
    do
        command
done
Back to top
View user's profile Send private message 
musher0

Joined: 04 Jan 2009
Posts: 12791
Location: Gatineau (Qc), Canada

PostPosted: Sat 15 Aug 2015, 18:39    Post subject:  

Hello, Andy.

Infinity is a beautiful thing, isn't ? Wink

Yes you can stop infinity... (Some will shed a tear...)
    * Open htop

    * Locate the command visually or with the F3 key, by typing its name in the little
    data entry rectangle at the bottom (middle) of the htop window.

    * The line in the htop listing for that command will become highlighted.

    * Hit F9

    * A column now appears on the left of the htop window.

    * It should have "SIGTERM" highlighted.

    * Hit Return.

    * That should kill the process.

    * If it hasn't, repeat the steps above but move the cursor up to # 9 SIGKILL in the
    __ left column. Hit Return. Now that's a proper executioner. Wink


~~~~~~~~
Will also work, from the (ahem) "terminal"... Sad
Code:
killall -q command

or
Code:
kill -s 9 `pidof -s command`

or "15", if "9" doesn't do the job.
~~~~~~~~

I hope that didn't help. Wink I love Infinity...

musher0

_________________
musher0
~~~~~~~~~~
Fidèle elle commença, ainsi elle restera. (Prov. canadien) /
Faithful she began, so will she stay. (Canadian prov.)

Last edited by musher0 on Sat 15 Aug 2015, 18:50; edited 2 times in total
Back to top
View user's profile Send private message 
scientist

Joined: 23 May 2015
Posts: 864

PostPosted: Sat 15 Aug 2015, 18:44    Post subject:  

I want just the opposite.

I found some fork bomb code.

I will not post it for obvious reasons.

Is there a way to limit the number of processes available for a Puppy user.
Code:

You can take same measures to ensure that your Linux users would not exploit fork bomb. Fork bomb is not a bug nor weakness of Linux system. The responsibility is in hands of systems administrators to limit number of processes available for a user by editing /etc/security/limits.conf file. To limit username forkbomb to only 50 processes add following line:

forkbomb hard nproc 50

_________________
Thanks,
Andy


Slacko 6.3.0 FULL INSTALL
JWM
File Manager - Thunar
Back to top
View user's profile Send private message 
musher0

Joined: 04 Jan 2009
Posts: 12791
Location: Gatineau (Qc), Canada

PostPosted: Sat 15 Aug 2015, 18:49    Post subject:  

Please decide?

If I know my logic, you can't eat a cake and a non-cake at the same time...

Also, your quote says what a fork bomb is NOT rather than what it is. So, if a "fork
bomb" is non-A, we'd also need a definition of A... (Just thinking out loud.)

BFN.

musher0

_________________
musher0
~~~~~~~~~~
Fidèle elle commença, ainsi elle restera. (Prov. canadien) /
Faithful she began, so will she stay. (Canadian prov.)
Back to top
View user's profile Send private message 
scientist

Joined: 23 May 2015
Posts: 864

PostPosted: Sat 15 Aug 2015, 19:01    Post subject:  

Maybe this will clarify.

Is there a way of preventing this from locking up system ?

I did not find limits.conf on my system.

Code:
# Fork bomb THIS WILL LOCK UP YOUR SYSTEM FORCING A REBOOT !!
#
bomb() {
 bomb | bomb &
}; bomb

_________________
Thanks,
Andy


Slacko 6.3.0 FULL INSTALL
JWM
File Manager - Thunar
Back to top
View user's profile Send private message 
musher0

Joined: 04 Jan 2009
Posts: 12791
Location: Gatineau (Qc), Canada

PostPosted: Sat 15 Aug 2015, 19:27    Post subject:  

Hello, Andy.

Simple: create one! With the settings and at the place in /etc suggested by the man
in your quote above.

BTW, that "bomb" looks like a virus to me... If it's an executable or a script, can you
not locate and delete said "bomb"? I think you can even make that "bomb-killer"
into an infinity loop script to keep your system safe, using "find" and its settings.

I've seen something similar on this forum (by big_pup, I believe) used to remove
duplicates on a partition, for example. But I'm not a specialist of "find" myself. "find"
is a mini-language in its own right, i.e. requiring careful study to get good results.

Sorry to hear about your problem, BTW. Break a leg...

musher0

_________________
musher0
~~~~~~~~~~
Fidèle elle commença, ainsi elle restera. (Prov. canadien) /
Faithful she began, so will she stay. (Canadian prov.)
Back to top
View user's profile Send private message 
scientist

Joined: 23 May 2015
Posts: 864

PostPosted: Sun 16 Aug 2015, 17:37    Post subject:  

Thanks.

It is not a virus in that it does not replicate, though some echo statements would make it replicate.

This works and prevents root user from starting more than 50 processes.

Code:
root   hard    nproc           50

_________________
Thanks,
Andy


Slacko 6.3.0 FULL INSTALL
JWM
File Manager - Thunar
Back to top
View user's profile Send private message 
musher0

Joined: 04 Jan 2009
Posts: 12791
Location: Gatineau (Qc), Canada

PostPosted: Mon 17 Aug 2015, 00:29    Post subject:  

Weird thing, isn't it?

In any case I'm glad that you found a solution.

BFN.

musher0

_________________
musher0
~~~~~~~~~~
Fidèle elle commença, ainsi elle restera. (Prov. canadien) /
Faithful she began, so will she stay. (Canadian prov.)
Back to top
View user's profile Send private message 
greengeek


Joined: 20 Jul 2010
Posts: 5216
Location: Republic of Novo Zelande

PostPosted: Mon 17 Aug 2015, 14:41    Post subject:  

scientist wrote:
This works and prevents root user from starting more than 50 processes.
Code:
root   hard    nproc           50
Thanks. I have added a link to your suggestion into the fork bomb discussion in an old thread of mine here
Back to top
View user's profile Send private message 
scientist

Joined: 23 May 2015
Posts: 864

PostPosted: Tue 18 Aug 2015, 12:41    Post subject:  

You are most welcome.
_________________
Thanks,
Andy


Slacko 6.3.0 FULL INSTALL
JWM
File Manager - Thunar
Back to top
View user's profile Send private message 
greengeek


Joined: 20 Jul 2010
Posts: 5216
Location: Republic of Novo Zelande

PostPosted: Wed 26 Aug 2015, 15:01    Post subject:  

scientist wrote:
This works and prevents root user from starting more than 50 processes.

Code:
root   hard    nproc           50
Hi, how did you use this? I am not succeeding with this syntax. Do you put it into a script or execute in a terminal? cheers
Back to top
View user's profile Send private message 
6502coder


Joined: 23 Mar 2009
Posts: 477
Location: Western United States

PostPosted: Wed 26 Aug 2015, 16:30    Post subject:  

greengeek wrote:
scientist wrote:
This works and prevents root user from starting more than 50 processes.

Code:
root   hard    nproc           50
Hi, how did you use this? I am not succeeding with this syntax. Do you put it into a script or execute in a terminal? cheers


See scientist's post above:

http://www.murga-linux.com/puppy/viewtopic.php?p=860573#860573
Back to top
View user's profile Send private message 
Ted Dog


Joined: 13 Sep 2005
Posts: 4013
Location: Heart of Texas

PostPosted: Wed 26 Aug 2015, 16:40    Post subject:  

see this link..
http://www.murga-linux.com/puppy/viewtopic.php?p=861833#861833

for How to stop infinite loop
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [13 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » Users ( For the regulars )
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0728s ][ Queries: 11 (0.0221s) ][ GZIP on ]