[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x

Linux OS Dev

Kernel programming for Linux operating systems can be done with many different languages; C, C++, Python, Perl and Java, which are some of the most common languages used.There are also many different varieties of Linux, such as Ubuntu, Fedora and OpenSUSE.

Share tech news, updates, or what's on your mind.

Sign up to Post

Hello there,

I want to restart my java application which is running on Ubuntu 16.04 as service. But the problem I have is on Ubuntu when I want to restart my java application service, I do as follows
sudo service myapp restart

Open in new window

and then Ubuntu asks for password. Now how can I tell Ubuntu to not ask password when I send this cmd from my application.

//Restart application server
		router.get("/restartAppService").handler(ctx -> {
			/* Build command: sudo service AooService stop */
			  final ArrayList<String> command = new ArrayList<String>();
			  command.add("sudo service TutisService restart");
			  System.out.println("CMD ----"+command.toString());
			  final ProcessBuilder builder = new ProcessBuilder(command);
			  	try {
			  		builder.start();
				} catch (IOException e) {
					System.out.println("EXCEPTION WHILE RESTARTING SERVICE----"+e.getMessage());
					e.printStackTrace();
				}
			  //System.exit(0);
		});

Open in new window


Any help will be appreciated!!

cheers
Zolf
0
Become a CompTIA Certified Healthcare IT Tech
LVL 12
Become a CompTIA Certified Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

Hi,

I have a NFS server on Ubuntu 16.04 LTS installed on it. The client machine has Windows Home edition , it connects to the server with ovpn which is
on another subnet,
I am unable to mount the NFS share from the client machine .
Kindly guide me how to connect to the NFS share on Ubuntu.

Thanks
0
Hello,

Does anyone have any idea how to authenticate a user against two different OUs on the same AD server?

I am using Apache 2.4 on Ubuntu 18.04.
Server version: Apache/2.4.18 (Ubuntu)
Server built:   2018-06-07T19:43:03

The user could be in "ABC User" or "XYZ user".
AD OUs are:
AuthLDAPURL "ldap://adx.ABC.org:389/OU=ABC Users,DC=ABC,DC=org?sAMAccountName?sub?(objectClass=*)"
and
AuthLDAPURL "ldap://adx.ABC.org:389/OU=XYZ Users,DC=ABC,DC=org?sAMAccountName?sub?(objectClass=*)"


Part of the current conf file:
<Location />
      AuthName "ABC Intranet"
        AuthBasicProvider ldap

        AuthType Basic
        AuthLDAPURL "ldap://adx.ABC.org:389/OU=ABC Users,DC=ABC,DC=org?sAMAccountName?sub?(objectClass=*)"

      # login to AD
      AuthLDAPBindDN "CN=ldap_ABCweb,OU=ABC Service Accounts,DC=ABC,DC=org"
        AuthLDAPBindPassword
        AuthLDAPGroupAttributeIsDN off
        AuthLDAPGroupAttribute memberUid

# tried this and failed
#      Require ldap-filter (&(memberOf='OU=XYZ Users,DC=ABC,DC=org?sAMAccountName?sub?(objectClass=*')|(memberOf='OU=ABC Users,DC=ABC,DC=org?sAMAccountName?sub?(objectClass=*'))

# tried this and failed                                     
#      <RequireAny>
#        Require ldap-filter (&(memberOf='OU=ABC Users,DC=ABC,DC=org?sAMAccountName?sub?(objectClass=*'))
#        Require ldap-filter (&(memberOf='OU=XYZ Users,DC=ABC,DC=org?sAMAccountName?sub?(objectClass=*'))
#       </RequireAny>

      # require any is implied
      require any
      Require valid-user
      …
0
i am using mputty to connect to unix box.

i see black screen with while log messages

i like to change to white bacground screen with black letter on top

please advise
0
Hi Experts,

I'm looking for a simple script to collect the local time drift on Ubuntu Bionic and send it to a specific TCP port in the local system.

Any advice would be highly appreciated.

Thanks & Regards,
Sumedha
0
Hi All,

I am looking to semi-automate the setup of Ubuntu machines.  I don't do that many, so this is more of an 'out of interest' thing than any real productivity issue.

For the avoidance of doubt, I am not looking for a full automated / scripted setup at this point, just to move some setup tasks from being a manual / GUI action to command line.

The first and simple thing is that, when I have setup a new Ubuntu install (16.04 or 18.04), I remove the 'Amazon' icon from the 'favourites' bar.

I do that by right-clicking, and selecting 'remove'.

My underastanding is that I could uninstall Unity Web Apps entirely with this:

sudo apt-get remove unity-webapps-common

Open in new window

which would include the Amazon icon going, but I don't want to remove anything else at this point (unless you think I should?)

I also found a reference that I could run:

sudo apt-get remove ubuntu-web-launchers

Open in new window

to remove the Amazon icon.

My concern is that often there is no explicit mention of what else might be removed or impacted, if anything, which makes me reluctant.

So, how can I just delete the icon from the favourites bar via the command line?


Thanks,

Alan.
0
to run below script to start web logic
/opt/scripts/bea_start admin
after login i cannot directly execute
i have to go to below directory to execute

cd /xyz/home/user123/opt/def/bea_domains/12/xyz_dev1/servers/xyz_dev1_admin/logs

i though below is absolute path and as soon as i login i should be able to run from
/opt/scripts/bea_start admin

also i have to run as admin only not as my user id

why i cannot run as soon as i login from root directory(if i am not mistaken that is what i go as soon as i login)

also how to see who all can run the script and how to change that script permission so that even if i login i can execute not just admin

Please advise
0
zgrep 'MobileDevice' xyz_1.log.20181121.gz|grep 'USER123'| awk '$0>= "2018-Nov-21 00:01" && $0<="2018-Nov-21 23:59"' | awk -F '|' '$24>300 {print}'

zgrep 'MobileDevice' xyz_2.log.20181121.gz|grep 'USER123'| awk '$0>= "2018-Nov-21 00:01" && $0<="2018-Nov-21 23:59"' | awk -F '|' '$24>300 {print}'

zgrep 'MobileDevice' xyz_3.log.20181121.gz|grep 'USER123'| awk '$0>= "2018-Nov-21 00:01" && $0<="2018-Nov-21 23:59"' | awk -F '|' '$24>300 {print}'

i am using above 3 separate greps one after other on 3 types of jvm files

how to combine them as one

zgrep 'MobileDevice' xyz_?.log.20181121.gz|grep 'USER123'| awk '$0>= "2018-Nov-21 00:01" && $0<="2018-Nov-21 23:59"' | awk -F '|' '$24>300 {print}'
i tried above which did not work
i tried below that also did not work


zgrep 'MobileDevice' xyz_*.log.20181121.gz|grep 'USER123'| awk '$0>= "2018-Nov-21 00:01" && $0<="2018-Nov-21 23:59"' | awk -F '|' '$24>300 {print}'
please advise
0
Hi,



 while adding ubuntu to vitual box after removing centos there getting attached error
i am using windows 10 hp laptop currently


please advise how resolve this error.



thanks in advance
ERRuBUNTU.png
0
zgrep 'xyz'  abc.log.2018111212| grep '|[1-9][0-9][0-9][0-9][0-9]|0000' | wc -l

i am trying to figure out what above grep doing?

what is meaning of
|[1-9][0-9][0-9][0-9][0-9]|0000

wc -l means some kind of word count?
what is -l

any good links or resources or video tutorials to master greps and awk and sed end to end to debug server logs?

please advise
0
Microsoft Azure 2017
LVL 12
Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

What's the best way to monitor for UDP syslog traffic coming in from a redhat 4 and redhat 5 syslog clients if it's not arriving at the syslog server. The syslog server is running on a Redhat 6 server. netstat -taulpe | grep syslog is showing that UDP is listening on all IP's on the server but I'd like to see if there is any other way apart from running  tcpdump -i <nic> port 514. Would watch lsof -a -i:514 show it?
0
I started with asking what the different is between "mode" and "flag", see: https://www.experts-exchange.com/questions/29122213/What-is-the-difference-between-mode-and-flag.html

However, I see that people are using different definitions for a flag. So it's better to start with the question: what is the definition of a flag? I'm not asking for general definitions, or your own definition, but specifically use the definitions in this post (and if necessary correct them and tell me what's wrong about the existing definition).

See: https://techterms.com/definition/flag

In computer science, a flag is a value that acts as a signal for a function or process. The value of the flag is used to determine the next step of a program. Flags are often binary flags, which contain a boolean value (true or false). However, not all flags are binary, meaning they can store a range of values.

Let's start with:

a flag is a value

So apparently, according to this definition, a flag IS a value. So a flag can not be seen as something that be two different values (two different states).

The next sentence confirms that:

Flags are often binary flags, which contain a boolean value (true or false).

Let's say we have c++ std::bitset, but it's about 1 bit. Firstable, it's important to be aware of the difference between:

1. setting the flag
2. setting the bitset

The bitset can be 1 or 0  (in this case because we have one …
0
When it's about "flags", I've noticed that different people have different ideas of what a flag is. Some people start to talk about "bit set" when it's about flags. I think the problem lies with the underlaying definitions. It looks like things are not well defined. So for this question, forget about your own ideas/definitions of what a bit set is, just follow the definitions in this post (and change them if necessary). Also forget about flags, this post is specifically about "bitset". First let's start with some "definitions":

See: http://www.cplusplus.com/reference/bitset/bitset/ (std::bitset)

A bitset stores bits (elements with only two possible values: 0 or 1, true or false, ...).

And see: http://www.cplusplus.com/reference/bitset/bitset/set/ (std::bitset::set)

all bits (1)      
bitset& set();
single bit (2)      
bitset& set (size_t pos, bool val = true);

(1) all bits
Sets (to one) all bits in the bitset.
(2) single bit
Sets val as the value for the bit at position pos.

I understand this. But now first let's start at the beginning and let's define a "bit". Let's define it like this:

A bit is an element of two possible binary values: either 0 or 1.

So let's see a bit as a box that contains a ball or a box that doesn't contain a ball. Now let's take a look at a bitset that represents the number 4:

 -----------------------
|0     | 0     |  1     |
|0*2^0 | 0*2^1 |  1*2^2 |
 -----------------------
3 boxes: 
Box 1: no ball
Box 2: no ball
Box 3: ball

Open in new window

0
In short, I would say:

A flag is a predefined bit or bit sequence that holds a binary value.

A mode is a distinct setting.

So it's not always possible to replace the term "mode" by "flag". This is only possible if it's about a binary value. I got confused by these terms when reading:

http://man7.org/linux/man-pages/man2/open.2.html

The argument flags must include one of the following access modes:
O_RDONLY, O_WRONLY, or O_RDWR.

The file creation flags are O_CLOEXEC,
O_CREAT, O_DIRECTORY, O_EXCL, O_NOCTTY, O_NOFOLLOW, O_TMPFILE, and
O_TRUNC.

The file status flags are all of the remaining flags listed
below.

Why they just don't say:

The file access flags are O_RDONLY, O_WRONLY, and O_RDWR.

Why they suddenly use a different term when it's about "access"? Probably behind the scenes it's also just about a binary value, right? Probably all O_VARIABLE's above are 0 or 1.

And see: https://en.wikipedia.org/wiki/File_descriptor

This table records the mode with which the file (or other resource) has been opened: for reading, writing, appending, and possibly other modes.

So Wikipedia uses the term "mode" only (and not flag). At least they are consistent, because they call them all "modes".

Is there a specific reason why sometimes mode is used and something flag (while it's about the same thing)? I would stay, be at least consistent to avoid confusion.
0
In reality, the "open file table" is not really a table, but let's say we will see it as a table. Which columns does this table have?

For example, see: https://cseweb.ucsd.edu/classes/sp16/cse120-a/applications/ln/lecture15.html

The open file table contains several pieces of information about each file:

the current offset (the next position to be accessed in the file)
a reference count (we'll explain below in the section about fork())
the file mode (permissions),
the flags passed into the open() (read-only, write-only, create, &c),
a pointer to an in-RAM version of the inode (a slightly light-weight version of the inode for each open file is kept in RAM -- others are on disk), and a structure that contains pointers to all of the .
A pointer to the structure containing pointers to the functions that implement the behaviors like read(), write(), close(), lseek(), &c on the file system that contains this file. This is the same structure we looked at last week when we discussed the file system interface to I/O devices.

So according to this, I would say:

- offset
- reference count
- file mode (permission)
- the flags passed into the open() (read-only, write-only, create, &c),
- pointer to in-RAM inode
- pointer to "read(), write(), close(), lseek(), &c".

But the file descriptor also points to the open file table, so we need another column that connects the "file descriptor table" with the "open file table". So I would add a column like:
0
unix server keep sign out after 1 minute or so on production.

is there is a way i can run some process like

tail -f xyz.gz
to keep continuous rolling until i cancel that so that it wont sign out on me while i focus on some other work  for 30 miinutes and come back it should not signout
please advise
0
Bump up the maximum user limit in Linux above the default 1024 causes the issues that brings down the application throughput

Gateway timeout issues

Maximum process increased

Issue observed  in performance testing
0
how to grep multiple awks

$ awk '{print;}' employee.txt
100  Thomas  Manager    Sales       $5,000
200  Jason   Developer  Technology  $5,500
300  Sanjay  Sysadmin   Technology  $7,000
400  Nisha   Manager    Marketing   $9,500
500  Randy   DBA        Technology  $6,000


$ awk '{print $2,$5;}' employee.txt
Thomas $5,000
Jason $5,500
Sanjay $7,000
Nisha $9,500
Randy $6,000

in above query how to tweak to see  see all records whose name starts with 'S' and Salary greater than '6000'

also
in above query how to tweak to see  see all records whose name starts with 'S' and Salary greater than '6000' and Department Starts with  'T'


100  Thomas  Manager    Sales       $5,000     08/08/1988 6:00:01AM
200  Jason   Developer  Technology  $5,500 08/08/1989 7:00:02AM
300  Sanjay  Sysadmin   Technology  $7,000 08/08/1982 9:00:03AM
400  Nisha   Manager    Marketing   $9,500 08/08/1981 10:00:04AM
500  Randy   DBA        Technology  $6,000 08/08/1981 11:00:5AM
if it has joined date and time as above
in above query how to tweak to see  see all records whose name starts with 'S' and Salary greater than '6000' and Department Starts with  'T' and joined between particular date time to particular date time say  08/08/1982 9:00:03 AM till 08/08/1981 10:00:04AM
i need to use above in a zgrep command

https://www.thegeekstuff.com/2010/01/awk-introduction-tutorial-7-awk-print-examples/
0
zgrep 'XYZ|AB|MASTER' AAAA.log.20180904.gz | grep '|[1-9][0-9][0-9][0-9][0-9]|0000' | wc -l

can you please advise what is the meaning of above zgrep command

where i can find, practice and learn above kind of commands

how grep and egrep are different

https://ryanstutorials.net/linuxtutorial/grep.php
how to learn regular expressions used in queries

Please advise
0
Rowby Goren Makes an Impact on Screen and Online
LVL 12
Rowby Goren Makes an Impact on Screen and Online

Learn about longtime user Rowby Goren and his great contributions to the site. We explore his method for posing questions that are likely to yield a solution, and take a look at how his career transformed from a Hollywood writer to a website entrepreneur.

See: https://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritecond


-h
Is symbolic link, bash convention.
See -l.


-l
Is symbolic link.
Treats the TestString as a pathname and tests whether or not it exists, and is a symbolic link. May also use the bash convention of -L or -h if there's a possibility of confusion such as when using the -lt or -le tests.


-L
Is symbolic link, bash convention.
See -l

What are the differences between these three?

"-h" has "bash concention" and "-l" not. But what is the difference in practise? Can someone give me an example of the difference?

And why it's "-L" and not "-H"? "-L" is about the bash convention, but "-l" not. However, "-h" is. So then I would expect "-H" instead of "-L".

I don't need it for something right now, but I'm trying to understand the Apache documentation.
0
hi am not able to type in my terminal its seemed locked and when the vm in locked am not able to type password am in solaris running in oracle vm
0
Hi,

I'm running CentOS Linux release 7.4.1708 (Core), issue is i'm able to login using local users but not using ldap users, please help me on this.

I've tried restarting services using authconfig-tui command, but still i'm getting authentication failure error for ldap user.

please see the attached doc (ldap issue.docx), and below output commands and let me know if any other details are required.


[root@server01 log]# cat /etc/openldap/ldap.conf
#
SASL_NOCANON    on
URI ldap://<ldap servrer ip>:389/
BASE dc=prod,dc=hclpnp,dc=com
#
[root@server01 log]# getent passwd testuser
testuser:*:123456:7001:testuser:/home/testuser:/bin/bash
[root@server01 log]#


[hubba@servder01 ~]$ su - testuser
Password:
su: Authentication failure



[root@server01 log]# cat /etc/nsswitch.conf
#
# /etc/nsswitch.conf
#
# An example Name Service Switch config file. This file should be
# sorted with the most-used services at the beginning.
#
# The entry '[NOTFOUND=return]' means that the search for an
# entry should stop if the search in the previous entry turned
# up nothing. Note that if the search failed due to some other reason
# (like no NIS server responding) then the search continues with the
# next entry.
#
# Valid entries include:
#
#       nisplus                 Use NIS+ (NIS version 3)
#       nis                     Use NIS (NIS version 2), also called YP
#       dns                     Use DNS (Domain Name Service)
#       files              …
0
I have an RHEL5 VM that reboots on kernel panics. The VM hangs while rebooting at different stages of the bootup process.
I noticed the console shows the cursor blinking but stays stuck booting up and does not progress.

Any ideas on how to troubleshoot? The blinking cursor indicates the system is hung, correct?
0
file create error on below site


https://www.tutorialspoint.com/execute_bash_online.php

please advise how to create some files and practice grep commands there

any other online free tools to practice unix.

please advise
fileCreate.png
0
what is the meaning of below command

zgrep 'CUSTOMERPASS' abcd.20180719.gz|grep -v 'Trials: 1'|less



Is there is single link, tutorial or video tutorial where i can find above kind of command
and
count command

more
less
grep
etc.

alll commonly used commands like above
why we need | before less?

Please advise
0

Linux OS Dev

Kernel programming for Linux operating systems can be done with many different languages; C, C++, Python, Perl and Java, which are some of the most common languages used.There are also many different varieties of Linux, such as Ubuntu, Fedora and OpenSUSE.