Hi all, can anyone advise what languages and concept can I use to implement the below idea in Linux? Both application and website is acceptable.
1. User submits file with individual account
2. File will be copied to a central account and a script will be executed in that account.
3. Report of the run script will be accessible to the user.
I tried to Google but could not get any findings.
Thank you.
User account is a virtual segregation in websites or even applications. It does not has to relate to any tangible system account may it be Linux, Windows or any OS real users.
There are 2 accounts here we need to be mindful, one is the process user which when running applications such as a web application, it is normal running under a particular user such as "httpd", "www-data" or could be any system users you specify. There are special cases for unix environments that is capable of assigning different process of the same application using different linux userid, commonly related to chroot, jailing, suexec, etc. Another user concept can be stored in any form of database such as a ldap, flat file, rdbms or as such. This form of users are authenticated normally by web login or other possible authentication mechanism and then the web applications will have routines written to segregate functionalities based on user. These are normally known as Authentication, Authorisation, and Access controls.
For your use case, it quite simple. All it requires is a simple web application running in the Apache web server
The web application will require the user to enter its credential to login. Once login, there will be a upload file for the user to upload your file. If the processing of the file is quick, it can be done in process with the report file stored in the server. Either the report can be display upon response, or a link can be provided for the end-user to download.
If the processing is slow. Then first save the file into a folder, there will be a monitoring script that is monitoring the input file and perform processing on it, where the report can be stored in the server. In this mode, after the user first upload the input file, the response will be just a processing message for the user to wait. The webpage can either periodically refresh or performing a background ajax call to another script to determine if the job is done. Once it's done, the user will be redirected to a page where the report is displayed or a link is available for download.
Now what should the monitoring script be monitoring. One way is monitor a specific directory for input file and then process it. Such method works but have slightly less control because the script need to know which user deposited this file. One can encode this piece of information into the filename to determine, but then after processing, how can the system knows that the job is done ? This has to be thought out. Another way is for script that receive the input file in the first place to write the file into the server and also write a task/job entry into the database. The monitoring script monitors the database for new jobs, pick up the job, process it and then update the entry for completion along with information like where the report is and so forth.
The page or background probe where it is monitoring the database for completed job meant for this particular user will pick up the completion and then proceed to display the report or a link for the user to download.
This form of processing techniques is very commonly designed and does not involved any central account or weird design. Just for your information, for even more scalable design that can deal with large number of processing, message queues can also be used but normally unless you are designing a system dealing with global scale users, normally a single database can handle the load just fine. There are also other databases options such as NoSQL good for such use cases.
Hope I answer your enquiries.