Saturday, 13 Dec 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  Blackstone Spearheads $2B Financing for Park Place Technologies

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

Clearspeed Raises $60M in Series D Funding

Clearspeed, a San Diego, CA-based voice-based threat evaluation know-how firm, raised $60M in Sequence D…

June 27, 2025

Microsoft to host CrowdStrike and others to discuss Windows security changes

Microsoft is internet hosting an essential summit on Home windows safety at its Redmond, Washington,…

August 23, 2024

IBM offers AI-based cloud service to manage complex networks

“What’s distinctive about these fashions is that they're custom-made and purpose-built for networking, pre-trained on…

October 3, 2025

Saronic Raises $600M in Series C Funding

Saronic Technologies, an Austin, TX-based developer of a shipyard designed to construct autonomous ships for…

February 19, 2025

Edge computing is the driving force behind more industries than you’d think

Edge computing is rising as a transformative power, revolutionizing industries in sudden methods. Historically, computing…

May 9, 2024

You Might Also Like

Why data centre megadeals must prove their value
Global Market

Why data centre megadeals must prove their value

By saad
photo illustration of clouds in the shape of dollar signs above a city
Global Market

Cloud providers continue to push EU court to undo Broadcom-VMware merger

By saad
Kao SEED Fund awards £30,000 to Harlow community projects
Global Market

Kao SEED Fund awards £30,000 to Harlow community projects

By saad
Close Up Portrait of Woman Working on Computer, Lines of Code Language Reflecting on her Glasses from Big Display Screens. Female Programmer Developing New Software, Coding, Managing Cybersecurity
Global Market

FinOps Foundation sharpens FOCUS to reduce cloud cost chaos

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.