Tuesday, April 30, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 454  / 2 Years ago, fri, may 27, 2022, 2:17:24

I have one jar which i need to run on startup and no matter whatever user is logged in and that need to take that user name automatcally
here this code can take user name



echo $(logname)


and this command i need to run on start up.



java -jar /home/(username)/VISDashboard2014/VISDashboard.jar


so now how can i take dynamically username in to this command.?


More From » 12.04

 Answers
7

You can use following conmand:



In which $USER is environment variable which gives username



java -jar /home/$USER/VISDashboard2014/VISDashboard.jar

[#24343] Friday, May 27, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
calronze

Total Points: 0
Total Questions: 110
Total Answers: 112

Location: Belarus
Member since Thu, Aug 11, 2022
2 Years ago
calronze questions
Sun, Jan 9, 22, 13:41, 2 Years ago
Wed, Feb 15, 23, 01:41, 1 Year ago
Sat, Jul 23, 22, 21:03, 2 Years ago
Sat, Feb 5, 22, 01:57, 2 Years ago
;