Sunday, 9 Nov 2025
Subscribe
logo
  • Global
  • AI
  • Cloud Computing
  • Edge Computing
  • Security
  • Investment
  • Sustainability
  • More
    • Colocation
    • Quantum Computing
    • Regulation & Policy
    • Infrastructure
    • Power & Cooling
    • Design
    • Innovations
    • Blog
Font ResizerAa
Data Center NewsData Center News
Search
  • Global
  • AI
  • Cloud Computing
  • Edge Computing
  • Security
  • Investment
  • Sustainability
  • More
    • Colocation
    • Quantum Computing
    • Regulation & Policy
    • Infrastructure
    • Power & Cooling
    • Design
    • Innovations
    • Blog
Have an existing account? Sign In
Follow US
© 2022 Foxiz News Network. Ruby Design Company. All Rights Reserved.
Data Center News > Blog > Global Market > How to log out of a Linux system from a script
Global Market

How to log out of a Linux system from a script

Last updated: July 30, 2024 2:08 am
Published July 30, 2024
Share
Night business woman with computer on glasses reflection for company innovation or eyes healthcare in digital, information technology career. Corporate manager reading, coding or software development
SHARE

Contents
Utilizing the supply builtinOne easy differentWrap-up

If you happen to run a script utilizing a command like exec myscript and the script features a logout command, the script will finish abruptly and so will the shell from wherein it was operating.

Utilizing the supply builtin

One other option to sign off of a system via a script is to make use of the supply builtin to run the script. Whenever you run a command corresponding to supply wait4three, the command will learn and execute all of the instructions included within the script simply as when you have been typing them. In different phrases, the constraints concerned in operating a script are eliminated.

One other advantage of utilizing the supply builtin is that you simply don’t want execute permission to run a script, simply learn entry.

One easy different

One quite simple different to logging out from inside a script is to run each the script and the logout command on one line – separated by a semicolon. This ensures that the logout command will run as soon as the script has completed.

$ wait4three; logout

The script proven earlier may then use exit as a substitute of logout.

#!/bin/bash

whereas true
do
  sleep 10
  depend=`who | wc -l`
  echo $depend
  if [ $count -ge 3 ]; then
    exit
  fi
performed

Wrap-up

Whereas logging out of a system from a script is never required, there could also be occasions when it is advisable to run a prolonged course of and wish to make sure that you’re logged out when it completes. Operating a script that features the logout command and operating with the exec or the supply builtin makes this doable.

See also  Converting between uppercase and lowercase on the Linux command line

Source link

TAGGED: Linux, log, script, System
Share This Article
Twitter Email Copy Link Print
Previous Article ADT’s new smart security system is now available nationwide. ADT Plus features new ADT hardware and integrates with Google Nest cameras and video doorbells, and the Yale Assure Lock 2. ADT’s new smart security system launches
Next Article Amazon strives to outpace Nvidia with cheaper, faster AI chips Amazon strives to outpace Nvidia with cheaper, faster AI chips
Leave a comment

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Your Trusted Source for Accurate and Timely Updates!

Our commitment to accuracy, impartiality, and delivering breaking news as it happens has earned us the trust of a vast audience. Stay ahead with real-time updates on the latest events, trends.
FacebookLike
TwitterFollow
InstagramFollow
YoutubeSubscribe
LinkedInFollow
MediumFollow
- Advertisement -
Ad image

Popular Posts

Acumera acquires Scale Computing to forge edge AI software leader

Edge networking and computing platforms supplier Acumera has acquired Scale Computing, combining their experience in…

August 5, 2025

Google Cloud partners with mLogica to offer mainframe modernization

Aside from the partnership with mLogica, Google Cloud additionally gives quite a lot of different…

March 27, 2025

What’s the most malicious TLD? Cloudflare reveals surprising risks, usage patterns

Evaluation reveals that .su doesn’t rank the best on any single day by distinctive networks.…

November 2, 2025

TurbineOne Raises $36M in Series B Funding

TurbineOne, a San Francisco, CA-based protection software program firm, raised $36M in Sequence B funding.…

May 14, 2025

AWS Dominated $57B Cloud Storage Services Market in 2023

The newest evaluation from Omdia has discovered that the worldwide cloud storage providers market generated $57 billion…

June 18, 2024

You Might Also Like

365 Data Centers and Robot Network Partner on Private Cloud AI
Global Market

365 Data Centers and Robot Network Partner on Private Cloud AI

By saad
LLMs, ChatGPT, Generative AI
Global Market

Perplexity’s open-source tool to run trillion-parameter models without costly upgrades

By saad
Gartner: Regular AI Audits Triple Generative AI Business Value
Global Market

Gartner: Regular AI Audits Triple Generative AI Business Value

By saad
A software developer selects a certification from their touchscreen.
Global Market

Cisco launches AI infrastructure, AI practitioner certifications

By saad
Data Center News
Facebook Twitter Youtube Instagram Linkedin

About US

Data Center News: Stay informed on the pulse of data centers. Latest updates, tech trends, and industry insights—all in one place. Elevate your data infrastructure knowledge.

Top Categories
  • Global Market
  • Infrastructure
  • Innovations
  • Investments
Usefull Links
  • Home
  • Contact
  • Privacy Policy
  • Terms & Conditions

© 2024 – datacenternews.tech – All rights reserved

Welcome Back!

Sign in to your account

Lost your password?
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.
You can revoke your consent any time using the Revoke consent button.